annotate src/xs_config.c @ 940:d624258d7800

Make messagebox functions public.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 17:59:52 +0200
parents 49b689449a37
children 63342bbeab47
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>
723
9321ffa2ea7e Update copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 722
diff changeset
7 (C) Copyright 1999-2009 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>
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
27 #define XS_CONFIG_FILE mcs_handle_t
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
28 #define XS_CONFIG_OPEN aud_cfg_db_open
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
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
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
31 #define XS_CFG_SET_STRING(q,z) aud_cfg_db_set_string(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
32 #define XS_CFG_SET_FLOAT(q,z) aud_cfg_db_set_float(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
33 #define XS_CFG_SET_INT(q,z) aud_cfg_db_set_int(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
34 #define XS_CFG_SET_BOOL(q,z) aud_cfg_db_set_bool(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
35 #define XS_CFG_GET_STRING(q,z) aud_cfg_db_get_string(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
36 #define XS_CFG_GET_FLOAT(q,z) aud_cfg_db_get_float(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
37 #define XS_CFG_GET_INT(q,z) aud_cfg_db_get_int(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
38 #define XS_CFG_GET_BOOL(q,z) aud_cfg_db_get_bool(cfg, XS_CONFIG_IDENT, q, z)
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>
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
41 #define XS_CONFIG_FILE ConfigFile
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
42 #define XS_CONFIG_OPEN xmms_cfg_open_default_file
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
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
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
45 #define XS_CFG_SET_STRING(q,z) xmms_cfg_write_string(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
46 #define XS_CFG_SET_FLOAT(q,z) xmms_cfg_write_float(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
47 #define XS_CFG_SET_INT(q,z) xmms_cfg_write_int(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
48 #define XS_CFG_SET_BOOL(q,z) xmms_cfg_write_boolean(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
49 #define XS_CFG_GET_STRING(q,z) xmms_cfg_read_string(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
50 #define XS_CFG_GET_FLOAT(q,z) xmms_cfg_read_float(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
51 #define XS_CFG_GET_INT(q,z) xmms_cfg_read_int(cfg, XS_CONFIG_IDENT, q, z)
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
52 #define XS_CFG_GET_BOOL(q,z) xmms_cfg_read_boolean(cfg, XS_CONFIG_IDENT, q, z)
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"
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
59 #include "xs_backend.h"
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,
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
68 *xs_rom_selector = NULL,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
69 *xs_filt_importselector = NULL,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
70 *xs_filt_exportselector = NULL;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
71
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
72
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
73 #define LUW(x) lookup_widget(xs_configwin, x)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
75
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
76 /* Samplerates
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
77 */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
78 static const gchar *xs_samplerates_table[] =
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
79 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
80 "8000", "11025", "22050",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
81 "44100", "48000", "64000",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
82 "96000"
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
83 };
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
84
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
85 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
86
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 * Configuration specific stuff
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 */
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
90 XS_MUTEX(xs_cfg);
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
91 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
92
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
93 static xs_cfg_item_t xs_cfgtable[] = {
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
94 { CTYPE_INT, &xs_cfg.audioBitsPerSample, "audioBitsPerSample" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
95 { CTYPE_INT, &xs_cfg.audioChannels, "audioChannels" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
96 { CTYPE_INT, &xs_cfg.audioFrequency, "audioFrequency" },
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
97
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
98 { CTYPE_BOOL, &xs_cfg.mos8580, "mos8580" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
99 { CTYPE_BOOL, &xs_cfg.forceModel, "forceModel" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
100 { CTYPE_BOOL, &xs_cfg.emulateFilters, "emulateFilters" },
713
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
101 { CTYPE_FLOAT, &xs_cfg.sid1Filter.fs, "filterFs" },
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
102 { CTYPE_FLOAT, &xs_cfg.sid1Filter.fm, "filterFm" },
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
103 { CTYPE_FLOAT, &xs_cfg.sid1Filter.ft, "filterFt" },
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
104 { CTYPE_INT, &xs_cfg.memoryMode, "memoryMode" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
105 { CTYPE_INT, &xs_cfg.clockSpeed, "clockSpeed" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
106 { 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
107
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
108 { CTYPE_INT, &xs_cfg.playerEngine, "playerEngine" },
190
e036ad3350d6 Cleanup
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
109
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
110 { CTYPE_INT, &xs_cfg.sid2Builder, "sid2Builder" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
111 { CTYPE_INT, &xs_cfg.sid2OptLevel, "sid2OptLevel" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
112 { 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
113
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
114 { CTYPE_INT, &xs_cfg.residSampling, "residSampling" },
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
115
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
116 { CTYPE_BOOL, &xs_cfg.playMaxTimeEnable, "playMaxTimeEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
117 { CTYPE_BOOL, &xs_cfg.playMaxTimeUnknown, "playMaxTimeUnknown" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
118 { CTYPE_INT, &xs_cfg.playMaxTime, "playMaxTime" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
119 { CTYPE_BOOL, &xs_cfg.playMinTimeEnable, "playMinTimeEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
120 { CTYPE_INT, &xs_cfg.playMinTime, "playMinTime" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
121 { CTYPE_BOOL, &xs_cfg.songlenDBEnable, "songlenDBEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
122 { CTYPE_STR, &xs_cfg.songlenDBPath, "songlenDBPath" },
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
123
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
124 { CTYPE_BOOL, &xs_cfg.stilDBEnable, "stilDBEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
125 { CTYPE_STR, &xs_cfg.stilDBPath, "stilDBPath" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
126 { CTYPE_STR, &xs_cfg.hvscPath, "hvscPath" },
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
127
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
128 { CTYPE_STR, &xs_cfg.romPath, "romPath" },
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
129
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
130 #ifndef AUDACIOUS_PLUGIN
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
131 { CTYPE_INT, &xs_cfg.subsongControl, "subsongControl" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
132 { CTYPE_BOOL, &xs_cfg.detectMagic, "detectMagic" },
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
133 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
134
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
135 { CTYPE_BOOL, &xs_cfg.titleOverride, "titleOverride" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
136 { CTYPE_STR, &xs_cfg.titleFormat, "titleFormat" },
258
e255f23abf33 Automatic subtune changing options added to config.
Matti Hamalainen <ccr@tnsp.org>
parents: 245
diff changeset
137
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
138 { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
139 { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
140 { CTYPE_INT, &xs_cfg.subAutoMinTime, "subAutoMinTime" },
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
141 };
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
142
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
143 static const gint xs_ncfgtable = 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
144
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
145
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
146 static xs_wid_item_t xs_cfgitems[] = {
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
147 { 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
148 { 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
149 { 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
150 { 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
151 { 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
152 { WTYPE_COMBO, CTYPE_INT, "cfg_samplerate", &xs_cfg.audioFrequency, XS_AUDIO_FREQ },
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
153
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
154 { 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
155 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2", &xs_cfg.playerEngine, XS_ENG_SIDPLAY2 },
850
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
156 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplayfp", &xs_cfg.playerEngine, XS_ENG_SIDPLAYFP },
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
157 { 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
158 { 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
159 { 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
160 { 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
161
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
162 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_mos8580", &xs_cfg.mos8580, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
163 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sid_force", &xs_cfg.forceModel, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
164 { 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
165 { 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
166 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_clock_force", &xs_cfg.forceSpeed, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
167 { 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
168
773
45108b3d88db Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents: 761
diff changeset
169 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sp2_resid_fp", &xs_cfg.sid2Builder, XS_BLD_RESID_FP },
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
170 { 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
171 { 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
172
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
173 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_resid_interpolate", &xs_cfg.residSampling, XS_RESID_INTERPOLATE },
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
174 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_resid_resample_fir", &xs_cfg.residSampling, XS_RESID_RESAMPLE_FIR },
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
175
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
176 { WTYPE_TEXT, CTYPE_STR, "cfg_emu_rom_path", &xs_cfg.romPath, 0 },
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
177
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
178 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_filters", &xs_cfg.emulateFilters, 0 },
713
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
179 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fs", &xs_cfg.sid1Filter.fs, 0 },
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
180 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fm", &xs_cfg.sid1Filter.fm, 0 },
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
181 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_ft", &xs_cfg.sid1Filter.ft, 0 },
64
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
182
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
183 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_enable", &xs_cfg.playMaxTimeEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
184 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_unknown", &xs_cfg.playMaxTimeUnknown, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
185 { WTYPE_SPIN, CTYPE_INT, "cfg_maxtime", &xs_cfg.playMaxTime, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
186 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_mintime_enable", &xs_cfg.playMinTimeEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
187 { WTYPE_SPIN, CTYPE_INT, "cfg_mintime", &xs_cfg.playMinTime, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
188 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_enable", &xs_cfg.songlenDBEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
189 { 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
190
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
191 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_stil_enable", &xs_cfg.stilDBEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
192 { WTYPE_TEXT, CTYPE_STR, "cfg_stil_dbpath", &xs_cfg.stilDBPath, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
193 { 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
194
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
195
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
196 #ifndef AUDACIOUS_PLUGIN
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
197 { 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
198 { 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
199 { 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
200 { 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
201
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
202 { 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
203 #endif
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
204
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
205 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_ftitle_override", &xs_cfg.titleOverride, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
206 { 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
207
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
208 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
209 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
210 { 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
211 };
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
212
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
213 static const gint xs_nwidtable = sizeof(xs_cfgitems) / sizeof(xs_cfgitems[0]);
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
216 /* Check configuration
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
217 */
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
218 gboolean xs_check_configuration(void)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
219 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
220 // Check for plain errors
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
221 switch (xs_cfg.playerEngine)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
222 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
223 case XS_ENG_SIDPLAYFP:
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
224 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
225 if (xs_cfg.romPath == NULL || xs_cfg.romPath[0] == 0)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
226 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
227 xs_messagebox("Error",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
228 "You have selected libSIDPlayFP backend, but not set the C64 ROM images directory.");
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
229 return FALSE;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
230 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
231
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
232 if (!xs_is_dir_path(xs_cfg.romPath))
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
233 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
234 xs_messagebox("Error",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
235 "The C64 ROM images directory path '%s' is not a directory.\n",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
236 xs_cfg.romPath);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
237 return FALSE;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
238 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
239
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
240 gint i;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
241 gchar *result = NULL;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
242 for (i = 0; i < XS_C64_ROM_IMAGES; i++)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
243 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
244 guint8 *buf = NULL;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
245 if (!xs_load_rom_image(i, &buf))
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
246 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
247 const XSROMImageData *rom = &xs_rom_images[i];
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
248 gchar *tmp = g_strdup_printf("%s%s file '%s'",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
249 result != NULL ? ", " : "",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
250 rom->name, rom->filename);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
251
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
252 xs_pstrcat(&result, tmp);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
253 g_free(tmp);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
254 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
255 g_free(buf);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
256 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
257
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
258 if (result != NULL)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
259 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
260 xs_messagebox("Error",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
261 "Could not load the required C64 ROM image files from '%s'.\n"
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
262 "\n"
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
263 "Following files could not be found: %s.",
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
264 xs_cfg.romPath, result);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
265 g_free(result);
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
266 return FALSE;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
267 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
268 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
269 break;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
270 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
271
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
272 // Automatic adjustments
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
273 switch (xs_cfg.sid2Builder)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
274 {
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
275 #if !defined(HAVE_RESID_BUILDER) && defined(HAVE_RESID_FP_BUILDER)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
276 case XS_BLD_RESID: xs_cfg.sid2Builder = XS_BLD_RESID_FP; break;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
277 #endif
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
278 #if defined(HAVE_RESID_BUILDER) && !defined(HAVE_RESID_FP_BUILDER)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
279 case XS_BLD_RESID_FP: xs_cfg.sid2Builder = XS_BLD_RESID; break;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
280 #endif
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
281 #if !defined(HAVE_HARDSID_BUILDER)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
282 case XS_BLD_HARDSID:
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
283 #if defined(HAVE_RESID_FP_BUILDER)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
284 xs_cfg.sid2Builder = XS_BLD_RESID_FP; break;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
285 #elif defined(HAVE_RESID_BUILDER)
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
286 xs_cfg.sid2Builder = XS_BLD_RESID; break;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
287 #endif
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
288 #endif
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
289 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
290
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
291 return TRUE;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
292 }
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
293
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
294
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
295 /* Reset/initialize the configuration
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 */
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
297 void xs_init_configuration(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
299 /* Lock configuration mutex */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
300 XSDEBUG("initializing configuration ...\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
301 XS_MUTEX_LOCK(xs_cfg);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
302
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
303 memset(&xs_cfg, 0, sizeof(xs_cfg));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
304
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
305 /* Initialize values with sensible defaults */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
306 xs_cfg.audioBitsPerSample = XS_RES_16BIT;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
307 xs_cfg.audioChannels = XS_CHN_MONO;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
308 xs_cfg.audioFrequency = XS_AUDIO_FREQ;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
309
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
310 xs_cfg.mos8580 = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
311 xs_cfg.forceModel = FALSE;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 228
diff changeset
312
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
313 /* Filter values */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
314 xs_cfg.emulateFilters = TRUE;
713
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
315 xs_cfg.sid1Filter.fs = XS_SIDPLAY1_FS;
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
316 xs_cfg.sid1Filter.fm = XS_SIDPLAY1_FM;
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
317 xs_cfg.sid1Filter.ft = XS_SIDPLAY1_FT;
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
318
761
641b7693fecc Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 750
diff changeset
319 #if defined(HAVE_SIDPLAY2)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
320 xs_cfg.playerEngine = XS_ENG_SIDPLAY2;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
321 xs_cfg.memoryMode = XS_MPU_REAL;
761
641b7693fecc Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 750
diff changeset
322 #elif defined(HAVE_SIDPLAY1)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
323 xs_cfg.playerEngine = XS_ENG_SIDPLAY1;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
324 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING;
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
325 #else
141
7327a985aee8 Typofixes
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
326 #error This should not happen! No emulator engines configured in!
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
327 #endif
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
328
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
329 xs_cfg.clockSpeed = XS_CLOCK_PAL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
330 xs_cfg.forceSpeed = FALSE;
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
331
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
332 xs_cfg.sid2OptLevel = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
333 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
334
831
9cd807b431c8 If we have reSID FP builder, we should not bail out. A theoretical
Matti Hamalainen <ccr@tnsp.org>
parents: 793
diff changeset
335 #if defined(HAVE_RESID_BUILDER) || defined(HAVE_RESID_FP_BUILDER)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
336 xs_cfg.sid2Builder = XS_BLD_RESID;
761
641b7693fecc Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 750
diff changeset
337 #elif defined(HAVE_HARDSID_BUILDER)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
338 xs_cfg.sid2Builder = XS_BLD_HARDSID;
761
641b7693fecc Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 750
diff changeset
339 #elif defined(HAVE_SIDPLAY2)
641b7693fecc Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 750
diff changeset
340 # error This should not happen! No supported SIDPlay2 builders configured in!
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
341 #endif
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
342
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
343 xs_cfg.playMaxTimeEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
344 xs_cfg.playMaxTimeUnknown = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
345 xs_cfg.playMaxTime = 150;
169
676ec1a1ab93 Minimum playtime option
Matti Hamalainen <ccr@tnsp.org>
parents: 161
diff changeset
346
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
347 xs_cfg.playMinTimeEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
348 xs_cfg.playMinTime = 15;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
349
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
350 xs_cfg.songlenDBEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
351 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
352
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
353 xs_cfg.stilDBEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
354 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
355 xs_pstrcpy(&xs_cfg.hvscPath, "~/C64Music");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
356
874
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
357 xs_pstrcpy(&xs_cfg.romPath, "/usr/lib/vice/C64");
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
358
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
359 #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
360 xs_cfg.subsongControl = XS_SSC_PATCH;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
361 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
362 xs_cfg.subsongControl = XS_SSC_POPUP;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
363 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
364 xs_cfg.detectMagic = FALSE;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365
745
9dc5378cc806 Remove XMMS_EXTRA stuff, as we require XMMS 1.2.10+ now.
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
366 xs_cfg.titleOverride = FALSE;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
367
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
368 #ifdef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
369 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
370 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
371 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
372 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
373
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
374 xs_cfg.subAutoEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
375 xs_cfg.subAutoMinOnly = TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
376 xs_cfg.subAutoMinTime = 15;
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
377
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
378
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
379 /* Unlock the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
380 XS_MUTEX_UNLOCK(xs_cfg);
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
381 }
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
382
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
383
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
384 /* Filter configuration handling
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
385 */
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
386 static void xs_filters_error(const gchar *fmt, ...)
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
387 {
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
388 va_list ap;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
389 gchar *msg;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
390
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
391 va_start(ap, fmt);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
392 msg = g_strdup_vprintf(fmt, ap);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
393 va_end(ap);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
394
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
395 xmms_show_message(_(PACKAGE_NAME " Error"), msg, _("OK"), TRUE, NULL, NULL);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
396 g_free(msg);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
397 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
398
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
399
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
400 static void xs_filter_free(xs_sid_filter_t *filter)
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
401 {
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
402 if (filter)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
403 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
404 g_free(filter->name);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
405 filter->name = NULL;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
406 g_free(filter);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
407 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
408 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
409
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
410
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
411 #define XS_FITEM (4 * 2)
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
412
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
413 static gboolean xs_filter_load_into(XS_CONFIG_FILE *cfg, gint nFilter, xs_sid_filter_t *filter)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
414 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
415 gchar tmpKey[64], *tmpStr;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
416 gint i, j;
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
417
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
418 /* Get fields from config */
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
419 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dType", nFilter);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
420 if (!XS_CFG_GET_INT(tmpKey, &(filter->type)))
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
421 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
422
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
423 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter);
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
424 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
425 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
426
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
427 filter->name = g_strdup(tmpStr);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
428 if (filter->name == NULL)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
429 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
430
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
431 switch (filter->type)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
432 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
433 case 1:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
434
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
435 /* Types 1 has points */
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
436 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
437 if (!XS_CFG_GET_INT(tmpKey, &(filter->npoints)))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
438 return FALSE;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
439
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
440 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
441 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
442 return FALSE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
443
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
444 for (i = 0, j = 0; i < filter->npoints; i++, j += XS_FITEM)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
445 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
446 if (sscanf(&tmpStr[j], "%4x%4x",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
447 &(filter->points[i].x),
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
448 &(filter->points[i].y)) != 2)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
449 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
450 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
451 break;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
452
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
453 case 3:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
454 /* Type 3 has tunables */
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
455 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData", nFilter);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
456 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
457 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
458
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
459 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->rate, &filter->point,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
460 &filter->voice_nonlinearity, &filter->cf_treshold) != 4)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
461 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
462
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
463 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData3", nFilter);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
464 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
465 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
466
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
467 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->baseresistance,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
468 &filter->offset, &filter->steepness,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
469 &filter->minimumfetresistance) != 4)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
470 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
471 break;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
472
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
473 case 4:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
474 /* Type 4 has fewer tunables */
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
475 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData4", nFilter);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
476 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
477 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
478
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
479 if (sscanf(tmpStr, "%f,%f", &filter->k, &filter->b) != 2)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
480 return FALSE;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
481 break;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
482
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
483 default:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
484 xs_error("Unknown filter type %d for '%s' (#%d).\n", filter->type, filter->name, nFilter);
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
485 return FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
486 }
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 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
489 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
490
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
491
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
492 static xs_sid_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
493 {
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
494 xs_sid_filter_t *filter;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
495
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
496 /* Allocate filter struct */
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
497 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
498 return NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
499
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
500 if (!xs_filter_load_into(cfg, nFilter, filter))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
501 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
502 xs_error("Error loading filter %d from configuration.\n", nFilter);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
503 xs_filter_free(filter);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
504 return NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
505 } else
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
506 return filter;
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
507 }
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
508
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
509
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
510 #if 0
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
511 static gboolean xs_filter_save(XS_CONFIG_FILE *cfg, xs_sid_filter_t *pFilter, gint nFilter)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
512 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
513 gchar *tmpValue, tmpKey[64];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
514 gint i, j;
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 /* Allocate memory for value string */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
517 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
518 if (tmpValue == NULL)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
519 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
520
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
521 /* Make value string */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
522 for (i = 0, j = 0; i < pFilter->npoints; i++, j += XS_FITEM)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
523 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
524 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
525 pFilter->points[i].x,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
526 pFilter->points[i].y);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
527 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
528
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
529 /* Write into the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
530 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter);
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
531 XS_CFG_SET_STRING(tmpKey, pFilter->name);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
532
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
533 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
534 XS_CFG_SET_INT(tmpKey, pFilter->npoints);
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
535
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
536 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
537 XS_CFG_SET_STRING(tmpKey, tmpValue);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
538
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
539 g_free(tmpValue);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
540 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
541 }
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
542 #endif
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
543
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
544
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
545 /* 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
546 * 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
547 */
600
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
548 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
549 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
550 size_t i;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
551
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
552 for (i = 0; i < tmpMax && inLine[*linePos] &&
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
553 inLine[*linePos] != sep; i++, (*linePos)++)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
554 tmpStr[i] = inLine[*linePos];
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
555
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
556 tmpStr[i] = 0;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
557 while (--i > 0 && isspace(tmpStr[i])) tmpStr[i] = 0;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
558
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
559 xs_findnext(inLine, linePos);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
560 return (inLine[*linePos] == sep);
600
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
561 }
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
562
711
d18884383ca3 Fix off by one.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
563
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
564 static gboolean xs_chkf(xs_sid_filter_t *filter, const gchar *str, const gchar *name, gint type)
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
565 {
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
566 if (g_strncasecmp(str, name, strlen(name)))
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
567 return FALSE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
568
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
569 if (filter->type != type)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
570 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
571 if (filter->type == -1)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
572 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
573 filter->type = type;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
574 return TRUE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
575 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
576 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
577 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
578 xs_error("Unexpected key '%s' for filter type %d.\n");
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
579 return FALSE;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
580 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
581 } else
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
582 return TRUE;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
583 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
584
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
585 static gboolean xs_filters_import(const gchar *filename, xs_sid_filter_t **pFilters, gint *nFilters)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
586 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
587 FILE *inFile;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
588 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
589 gchar *sectName = NULL;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
590 gboolean inSection, isError = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
591 size_t lineNum, i;
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
592 xs_sid_filter_t *filter = NULL;
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
593
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
594 fprintf(stderr, "xs_filters_import(%s)\n", filename);
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
595
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
596 if ((inFile = fopen(filename, "ra")) == NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
597 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
598 xs_filters_error("");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
599 return FALSE;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
600 }
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
601
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
602 fprintf(stderr, "importing...\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
603
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
604 inSection = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
605 lineNum = 0;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
606 while (fgets(inLine, XS_BUF_SIZE, inFile) != NULL && !isError)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
607 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
608 size_t linePos = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
609 lineNum++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
610
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
611 xs_findnext(inLine, &linePos);
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
612 if (isalpha(inLine[linePos]))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
613 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
614 /* A new key/value pair */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
615 if (!xs_fgetitem(inLine, &linePos, '=', tmpStr, XS_BUF_SIZE))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
616 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
617 xs_error("Invalid line '%s' :: expected =", inLine);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
618 isError = TRUE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
619 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
620 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
621 if (inSection)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
622 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
623 linePos++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
624 xs_findnext(inLine, &linePos);
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
625
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
626 if (xs_chkf(filter, tmpStr, "points", 1))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
627 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
628 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
629 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
630 if (xs_chkf(filter, tmpStr, "point", 1))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
631 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
632
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
633 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
634 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
635 if (!g_strncasecmp(tmpStr, "type", 4))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
636 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
637 if (filter->type != -1)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
638 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
639 xs_error("Filter type %d already set for '%s'\n",
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
640 filter->type, sectName);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
641 }
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
642 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
643 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
644 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
645 xs_error("Unsupported definition '%s' @ '%s'\n",
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
646 tmpStr, sectName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
647 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
648 }
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
649 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
650 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
651 if (inLine[linePos] == '[')
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
652 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
653 /* Check for existing section */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
654 if (inSection)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
655 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
656 /* Submit definition */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
657 fprintf(stderr, "filter ends: %s\n", sectName);
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
658 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
659 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
660 fprintf(stderr, "could not allocate ..\n");
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
661 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
662 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
663 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
664
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
665 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
666 g_free(sectName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
667 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
668
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
669 /* New filter(?) section starts */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
670 linePos++;
711
d18884383ca3 Fix off by one.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
671 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
672 tmpStr[i] = inLine[linePos];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
673 tmpStr[i] = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
674
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
675 if (inLine[linePos] != ']')
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
676 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
677 fprintf(stderr, "invalid! expected ']': %s\n", inLine);
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
678 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
679 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
680 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
681 if (!g_strncasecmp(tmpStr, "filter", 6))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
682 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
683 sectName = strdup(tmpStr + 6);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
684 fprintf(stderr, "filter: %s\n", sectName);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
685 inSection = TRUE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
686 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
687 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
688 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
689 fprintf(stderr, "ignoring section: %s\n", tmpStr);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
690 inSection = FALSE;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
691 }
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
692 }
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
693 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
694 else if (inLine[linePos] != '#' && inLine[linePos] != ';' && inLine[linePos] != 0)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
695 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
696 /* Syntax error */
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
697 xs_error("Syntax error: '%s'\n", inLine);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
698 isError = TRUE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
699 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
700 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
701
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
702 fclose(inFile);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
703 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
704 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
705
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
706
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
707 static gboolean xs_filter_export(FILE *outFile, xs_sid_filter_t *filter)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
708 {
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
709 gint i;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
710
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
711 fprintf(outFile,
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
712 "[Filter%s]\n"
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
713 "type=%d\n",
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
714 filter->name, filter->type);
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
715
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
716 switch (filter->type)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
717 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
718 case 1:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
719 fprintf(outFile, "points=%d\n", filter->npoints);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
720
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
721 for (i = 0; i < filter->npoints; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
722 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
723 fprintf(outFile,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
724 "point%d=%d,%d\n",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
725 i + 1,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
726 filter->points[i].x,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
727 filter->points[i].y);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
728 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
729 break;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
730
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
731 case 3:
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
732 fprintf(outFile,
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
733 "DistortionRate = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
734 "DistortionPoint = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
735 "VoiceNonlinearity = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
736 "DistortionCFThreshold = %f\n",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
737 filter->rate, filter->point,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
738 filter->voice_nonlinearity,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
739 filter->cf_treshold);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
740
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
741 fprintf(outFile,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
742 "Type3BaseResistance = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
743 "Type3Offset = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
744 "Type3Steepness = %f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
745 "Type3MinimumFETResistance = %f\n",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
746 filter->baseresistance, filter->offset,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
747 filter->steepness, filter->minimumfetresistance);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
748 break;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
749
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
750 case 4:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
751 fprintf(outFile,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
752 "Type4K=%f\n"
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
753 "Type4B=%f\n",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
754 filter->k, filter->b);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
755 break;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
756
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
757 default:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
758 xs_error("Filter '%s' has type %d, which is unsupported by export.\n",
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
759 filter->name, filter->type);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
760 return FALSE;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
761 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
762
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
763 fprintf(outFile, "\n");
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
764 return TRUE;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
765 }
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
766
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
767
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
768 static gboolean xs_filters_export(const gchar *filename, xs_sid_filter_t **filters, gint nfilters)
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
769 {
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
770 gboolean result = TRUE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
771 FILE *outFile;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
772 gint n;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
773
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
774 /* Open/create the file */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
775 if ((outFile = fopen(filename, "wa")) == NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
776 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
777 xs_filters_error("Could not open '%s' for writing! Not exporting.", filename);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
778 return FALSE;
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
779 }
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
780
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
781 /* Header */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
782 fprintf(outFile,
713
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
783 "; SIDPlay2 compatible filter definition file\n"
06db79680afe Added new variables for distortion tunables and made few changes to SID1
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
784 "; Exported by " PACKAGE_STRING "\n\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
785
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
786 /* Write each filter spec in "INI"-style format */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
787 for (n = 0; n < nfilters; n++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
788 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
789 if (!xs_filter_export(outFile, filters[n]))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
790 {
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
791 result = FALSE;
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
792 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
793 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
794 }
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 fclose(outFile);
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
797
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
798 if (!result)
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
799 xs_filters_error("Some filters could not be exported!");
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
800
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
801 return result;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
802 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
803
721
2b6a29eefffb More work on implementing working filter saving, loading, importing and
Matti Hamalainen <ccr@tnsp.org>
parents: 720
diff changeset
804
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
805 /* 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
806 */
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
807 gboolean xs_read_configuration(void)
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
808 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
809 XS_CONFIG_FILE *cfg;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
810 gint i;
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
811 gboolean configOK = TRUE;
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
812
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
813 /* Try to open the XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
814 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
815 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
816
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
817 cfg = XS_CONFIG_OPEN();
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
818 if (cfg == NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
819 {
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
820 configOK = FALSE;
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
821 goto error;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
822 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
823
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
824 /* Read the new settings from XMMS configuration file */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
825 for (i = 0; i < xs_ncfgtable; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
826 switch (xs_cfgtable[i].itemType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
827 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
828 case CTYPE_INT:
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
829 if (!XS_CFG_GET_INT(xs_cfgtable[i].itemName,
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
830 (gint *) xs_cfgtable[i].itemData))
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
831 configOK = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
832 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
833
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
834 case CTYPE_BOOL:
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
835 if (!XS_CFG_GET_BOOL(xs_cfgtable[i].itemName,
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
836 (gboolean *) xs_cfgtable[i].itemData))
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
837 configOK = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
838 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
839
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
840 case CTYPE_FLOAT:
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
841 if (!XS_CFG_GET_FLOAT(xs_cfgtable[i].itemName,
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
842 (gfloat *) xs_cfgtable[i].itemData))
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
843 configOK = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
844 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
845
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
846 case CTYPE_STR:
874
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
847 {
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
848 gchar *tmpStr;
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
849 if (XS_CFG_GET_STRING(xs_cfgtable[i].itemName,
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
850 (gchar **) &tmpStr))
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
851 {
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
852 xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr);
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
853 g_free(tmpStr);
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
854 }
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
855 else
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
856 configOK = FALSE;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
857 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
858 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
859 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
860
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
861 /* Filters and presets are a special case */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
862 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
863
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
864 if (xs_cfg.sid2NFilterPresets > 0)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
865 {
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
866 xs_cfg.sid2FilterPresets = g_malloc0(xs_cfg.sid2NFilterPresets * sizeof(xs_sid_filter_t *));
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
867 if (!xs_cfg.sid2FilterPresets)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
868 {
666
50e036a32db8 De-gettextize.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
869 xs_error("Allocation of sid2FilterPresets structure failed!\n");
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
870 configOK = FALSE;
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
871 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
872 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
873 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
874 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
875 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
876 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
877 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
878
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
879 error:
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
880 if (cfg != NULL)
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
881 {
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
882 XS_CONFIG_FREE(cfg);
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
883 }
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
884 XS_MUTEX_UNLOCK(xs_cfg);
939
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
885 XSDEBUG("%s\n", configOK ? "OK" : "ERRORS!");
49b689449a37 Change xs_read_configuration() to return a boolean value, TRUE if
Matti Hamalainen <ccr@tnsp.org>
parents: 914
diff changeset
886 return configOK;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
887 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
888
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
889
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
890 /* Write the current configuration
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
891 */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
892 gint xs_write_configuration(void)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
893 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
894 XS_CONFIG_FILE *cfg;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
895 gint i;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
896
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
897 XSDEBUG("writing configuration ...\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
898 XS_MUTEX_LOCK(xs_cfg);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
899
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
900 /* Try to open the XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
901 cfg = XS_CONFIG_OPEN();
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
902
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
903 #ifndef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
904 if (!cfg) cfg = xmms_cfg_new();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
905 if (!cfg) return -1;
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
906 #endif
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
907
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
908 /* Write the new settings to XMMS configuration file */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
909 for (i = 0; i < xs_ncfgtable; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
910 switch (xs_cfgtable[i].itemType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
911 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
912 case CTYPE_INT:
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
913 XS_CFG_SET_INT(xs_cfgtable[i].itemName,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
914 *(gint *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
915 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
916
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
917 case CTYPE_BOOL:
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
918 XS_CFG_SET_BOOL(xs_cfgtable[i].itemName,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
919 *(gboolean *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
920 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
921
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
922 case CTYPE_FLOAT:
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
923 XS_CFG_SET_FLOAT(xs_cfgtable[i].itemName,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
924 *(gfloat *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
925 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
926
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
927 case CTYPE_STR:
720
0feeaf698a54 Clean up the XS_CFG_* macros a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
928 XS_CFG_SET_STRING(xs_cfgtable[i].itemName,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
929 *(gchar **) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
930 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
931 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
932
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
933
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
934 #ifndef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
935 xmms_cfg_write_default_file(cfg);
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
936 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
937 XS_CONFIG_FREE(cfg);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
938
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
939 XS_MUTEX_UNLOCK(xs_cfg);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
940
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
941 return 0;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
942 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
943
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
944
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
945 /* Configuration panel was canceled
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
946 */
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
947 XS_DEF_WINDOW_CLOSE(cfg_cancel, configwin)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
948
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
949
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
950 /* Configuration was accepted, save the settings
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
951 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
952 void xs_cfg_ok(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
953 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
954 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
955 gfloat tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
956 gint tmpInt;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
957 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
958
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
959 /* Get lock on configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
960 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
961
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
962 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
963
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
964 for (i = 0; i < xs_nwidtable; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
965 switch (xs_cfgitems[i].widType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
966 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
967 case WTYPE_BGROUP:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
968 /* Check if toggle-button is active */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
969 if (GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName))->active)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
970 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
971 /* Yes, set the constant value */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
972 *((gint *) xs_cfgitems[i].itemData) = xs_cfgitems[i].itemSet;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
973 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
974 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
975
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
976 case WTYPE_COMBO:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
977 /* Get text from text-widget */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
978 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
979 if (sscanf(tmpStr, "%d", &tmpInt) != 1)
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
980 tmpInt = xs_cfgitems[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
981
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
982 *((gint *) xs_cfgitems[i].itemData) = tmpInt;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
983 break;
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 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
986 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
987 /* Get the value */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
988 switch (xs_cfgitems[i].widType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
989 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
990 case WTYPE_SPIN:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
991 tmpValue = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_cfgitems[i].widName)))->value;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
992 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
993
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
994 case WTYPE_SCALE:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
995 tmpValue = gtk_range_get_adjustment(GTK_RANGE(LUW(xs_cfgitems[i].widName)))->value;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
996 break;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
997
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
998 default:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
999 tmpValue = -1;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1000 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1001 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1002
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1003 /* Set the value */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1004 switch (xs_cfgitems[i].itemType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1005 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1006 case CTYPE_INT:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1007 *((gint *) xs_cfgitems[i].itemData) = (gint) tmpValue;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1008 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1009
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1010 case CTYPE_FLOAT:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1011 *((gfloat *) xs_cfgitems[i].itemData) = tmpValue;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1012 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1013 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1014 break;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1015
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1016 case WTYPE_BUTTON:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1017 /* Check if toggle-button is active */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1018 *((gboolean *) xs_cfgitems[i].itemData) =
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1019 (GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName))->active);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1020 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1021
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1022 case WTYPE_TEXT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1023 /* Get text from text-widget */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1024 xs_pstrcpy((gchar **) xs_cfgitems[i].itemData,
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1025 gtk_entry_get_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName))));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1026 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1027 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1028
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1029 // Check the settings
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1030 if (!xs_check_configuration())
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1031 goto error;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1032
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1033 /* Get filter settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1034 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1035 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
1036 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
1037 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1038 */
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1039
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1040 /* Release lock */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1041 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1042
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1043 /* Close window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1044 gtk_widget_destroy(xs_configwin);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1045 xs_configwin = NULL;
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1046
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1047 /* Write settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1048 xs_write_configuration();
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1049
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1050 /* Re-initialize */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1051 xs_reinit();
913
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1052 return;
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1053
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1054 error:
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1055 /* Release lock */
f8aa81ac2528 Improve configuration sanity checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 904
diff changeset
1056 XS_MUTEX_UNLOCK(xs_cfg);
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1057 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1058
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1059
896
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1060 void xs_messagebox_ok(GtkButton *button, gpointer user_data)
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1061 {
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1062 (void) button;
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1063 gtk_widget_destroy(GTK_WIDGET(user_data));
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1064 }
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1065
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1066
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1067 void xs_messagebox_const(const gchar *title, const gchar *msg)
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1068 {
914
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1069 GtkWidget *wid, *win = create_xs_messagebox();
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1070 gchar *ntitle;
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1071
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1072 if (win == NULL)
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1073 return;
896
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1074
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1075 gtk_signal_connect(
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1076 GTK_OBJECT(lookup_widget(win, "xs_messagebox_ok")),
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1077 "clicked", GTK_SIGNAL_FUNC(xs_messagebox_ok), win);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1078
914
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1079 ntitle = g_strdup_printf("%s %s", PACKAGE_NAME, title != NULL ? title : "message");
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1080 if (ntitle != NULL)
896
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1081 {
914
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1082 gtk_window_set_title(GTK_WINDOW(win), ntitle);
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1083
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1084 if ((wid = lookup_widget(win, "xs_messagebox_frame")) != NULL)
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1085 gtk_frame_set_label(GTK_FRAME(wid), ntitle);
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1086
3fdb0af448c7 Improve messagebox, set the window title also.
Matti Hamalainen <ccr@tnsp.org>
parents: 913
diff changeset
1087 g_free(ntitle);
896
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1088 }
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1089
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1090 if ((wid = lookup_widget(win, "xs_messagebox_msg")) != NULL)
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1091 {
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1092 gtk_label_set_text(GTK_LABEL(wid), msg);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1093 }
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1094
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1095 gtk_widget_show(win);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1096 }
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1097
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1098
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1099 void xs_messagebox(const gchar *title, const gchar *fmt, ...)
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1100 {
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1101 va_list ap;
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1102 gchar *msg;
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1103
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1104 va_start(ap, fmt);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1105 msg = g_strdup_vprintf(fmt, ap);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1106 va_end(ap);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1107
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1108 xs_messagebox_const(title, msg);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1109 g_free(msg);
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1110 }
911401ea2145 Add message box functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 886
diff changeset
1111
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1112 /* Confirmation window
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1113 */
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1114 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
1115 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1116 (void) widget;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1117 (void) event;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1118 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1119
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1120 return FALSE;
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1121 }
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1122
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1123
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1124
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1125 /* HVSC songlength-database file selector response-functions
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1126 */
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1127 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1128 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1129 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1130 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1131
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1132 if (xs_sldb_fileselector != NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1133 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1134 XS_WINDOW_PRESENT(xs_sldb_fileselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1135 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1136 }
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
1137
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1138 xs_sldb_fileselector = create_xs_sldb_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1139 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1140 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
1141 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1142 gtk_widget_show(xs_sldb_fileselector);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1143 }
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1144
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1145
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1146 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
1147 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1148 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1149 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1150
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1151 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1152 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_sld_dbpath")),
897
cfc20df88401 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 896
diff changeset
1153 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
1154
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1155 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1156 gtk_widget_destroy(xs_sldb_fileselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1157 xs_sldb_fileselector = NULL;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1158 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1159
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
1160 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
1161 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
1162
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1163
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1164 /* STIL-database file selector response-functions
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1165 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1166 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
1167 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1168 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1169 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1170
874
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
1171 if (xs_stil_fileselector != NULL)
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
1172 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1173 XS_WINDOW_PRESENT(xs_stil_fileselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1174 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1175 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1176
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1177 xs_stil_fileselector = create_xs_stil_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1178 XS_MUTEX_LOCK(xs_cfg);
900
eba5d47edc13 Remember the current values when opening the file browsers of config dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 898
diff changeset
1179 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_stil_fileselector),
eba5d47edc13 Remember the current values when opening the file browsers of config dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 898
diff changeset
1180 gtk_entry_get_text(GTK_ENTRY(LUW("cfg_stil_dbpath"))));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1181 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1182 gtk_widget_show(xs_stil_fileselector);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1183 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1184
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
1185
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1186 void xs_stil_fs_ok(GtkButton *button, gpointer user_data)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1187 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1188 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1189 (void) user_data;
579
6b2c682cc0a8 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 578
diff changeset
1190
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1191 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1192 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
1193 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_stil_fileselector)));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1194
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1195 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1196 gtk_widget_destroy(xs_stil_fileselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1197 xs_stil_fileselector = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1198 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1199
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1200
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
1201 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
1202 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
1203
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1204
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1205 /* 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
1206 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1207 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
1208 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1209 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1210 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1211
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1212 if (xs_hvsc_selector != NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1213 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1214 XS_WINDOW_PRESENT(xs_hvsc_selector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1215 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1216 }
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1217
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1218 xs_hvsc_selector = create_xs_hvsc_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1219 XS_MUTEX_LOCK(xs_cfg);
900
eba5d47edc13 Remember the current values when opening the file browsers of config dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 898
diff changeset
1220 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_hvsc_selector),
eba5d47edc13 Remember the current values when opening the file browsers of config dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 898
diff changeset
1221 gtk_entry_get_text(GTK_ENTRY(LUW("cfg_hvsc_path"))));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1222 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1223 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
1224 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1225
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1226
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1227 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
1228 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1229 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1230 (void) user_data;
898
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1231 gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector));
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1232 if (!xs_is_dir_path(result))
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1233 {
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1234 path = xs_get_dir_path(result);
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1235 xs_messagebox("Warning",
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1236 "Selected HVSC path '%s' does not seem like a path, adjusting to '%s'.\n",
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1237 result, path);
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1238 }
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1239 else
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1240 path = result;
579
6b2c682cc0a8 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 578
diff changeset
1241
898
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1242 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), path);
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1243
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1244 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1245 gtk_widget_destroy(xs_hvsc_selector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1246 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
1247 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1248
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1249
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
1250 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
1251 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
1252
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1253
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1254 /* C64 ROM path selector response-functions
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1255 */
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1256 void xs_cfg_rom_browse(GtkButton * button, gpointer user_data)
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1257 {
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1258 (void) button;
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1259 (void) user_data;
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1260
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1261 if (xs_rom_selector != NULL)
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1262 {
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1263 XS_WINDOW_PRESENT(xs_rom_selector);
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1264 return;
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1265 }
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1266
874
350f755549dd More work on the ROM images configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 871
diff changeset
1267 xs_rom_selector = create_xs_rom_fs();
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1268 XS_MUTEX_LOCK(xs_cfg);
900
eba5d47edc13 Remember the current values when opening the file browsers of config dialog.
Matti Hamalainen <ccr@tnsp.org>
parents: 898
diff changeset
1269 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_rom_selector),
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
1270 gtk_entry_get_text(GTK_ENTRY(LUW("cfg_emu_rom_path"))));
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1271 XS_MUTEX_UNLOCK(xs_cfg);
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1272 gtk_widget_show(xs_rom_selector);
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1273 }
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1274
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1275
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1276 void xs_rom_fs_ok(GtkButton *button, gpointer user_data)
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1277 {
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1278 (void) button;
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1279 (void) user_data;
898
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1280 gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_rom_selector));
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1281 if (!xs_is_dir_path(result))
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1282 {
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1283 path = xs_get_dir_path(result);
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1284 xs_messagebox("Warning",
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1285 "Selected ROM path '%s' does not seem like a path, adjusting to '%s'.\n",
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1286 result, path);
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1287 }
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1288 else
212d4738438d Use the message box dialog, inform user when the path is not a directory
Matti Hamalainen <ccr@tnsp.org>
parents: 897
diff changeset
1289 path = result;
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1290
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
1291 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_emu_rom_path")), path);
871
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1292
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1293 /* Close file selector window */
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1294 gtk_widget_destroy(xs_rom_selector);
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1295 xs_rom_selector = NULL;
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1296 }
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1297
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1298
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1299 XS_DEF_WINDOW_CLOSE(rom_fs_cancel, rom_selector)
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1300 XS_DEF_WINDOW_DELETE(rom_fs, rom_selector)
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1301
d183ac29b879 Add ROM image path configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 850
diff changeset
1302
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1303 /* Filter handling
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1304 */
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1305 void xs_cfg_sp1_filter_reset(GtkButton * button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1306 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1307 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1308 (void) user_data;
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1309
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1310 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
1311 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
1312 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
1313 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1314
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1315
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
1316 void xs_cfg_sp2_filter_update(XSCurve *curve, xs_sid_filter_t *f)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1317 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1318 assert(curve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1319 assert(f);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1320
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1321 xs_curve_reset(curve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1322 xs_curve_set_range(curve, 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX);
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1323 if (!xs_curve_set_points(curve, f->points, f->npoints))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1324 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1325 // FIXME
666
50e036a32db8 De-gettextize.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
1326 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
1327 }
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1328 }
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1329
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1330
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1331 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
1332 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1333 GList *tmpList = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1334 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1335
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1336 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1337 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1338 tmpList = g_list_append(tmpList,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1339 (gpointer) xs_cfg.sid2FilterPresets[i]->name);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1340 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1341
750
3180bf22090f Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 748
diff changeset
1342 if (tmpList != NULL)
3180bf22090f Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 748
diff changeset
1343 gtk_combo_set_popdown_strings(GTK_COMBO(LUW("cfg_sp2_filter_combo")), tmpList);
3180bf22090f Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 748
diff changeset
1344
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1345 g_list_free(tmpList);
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1346 }
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1347
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1348
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1349 void xs_cfg_sp2_filter_load(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1350 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1351 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1352 gint i, j;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1353
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1354 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1355 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1356
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1357 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1358
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1359 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1360 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1361 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1362 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1363 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1364 j = i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1365 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1366 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1367 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1368
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1369 if (j != -1)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1370 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1371 fprintf(stderr, "Updating from '%s'\n", tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1372 xs_cfg_sp2_filter_update(
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1373 XS_CURVE(LUW("cfg_sp2_filter_curve")),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1374 xs_cfg.sid2FilterPresets[i]);
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1375 }
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1376 else
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1377 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1378 /* error/warning: no such filter preset */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1379 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
1380 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1381
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1382 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1383 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1384
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1385
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1386 void xs_cfg_sp2_filter_save(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1387 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1388 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1389 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
1390 yes) ask if saving over ok?
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1391 no) ...
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1392
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1393 2) save current filter to the name
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1394 */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1395 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1396 gint i, j;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1397
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1398 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1399 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1400
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1401 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1402
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1403 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1404 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1405 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1406 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name))
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1407 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1408 j = i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1409 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1410 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1411 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1412
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1413 if (j != -1)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1414 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1415 fprintf(stderr, "Found, confirm overwrite?\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1416 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1417
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1418 fprintf(stderr, "saving!\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1419
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1420 xs_cfg_sp2_presets_update();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1421
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1422 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1423 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1424
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1425
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1426 void xs_cfg_sp2_filter_delete(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1427 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1428 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1429 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1430 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1431 1) confirm
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1432 2) delete
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1433 */
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1434 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1435
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1436
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1437 void xs_cfg_sp2_filter_import(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1438 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1439 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1440 (void) user_data;
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1441
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1442 if (xs_filt_importselector != NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1443 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1444 XS_WINDOW_PRESENT(xs_filt_importselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1445 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1446 }
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1447
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1448 xs_filt_importselector = create_xs_filter_import_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1449 gtk_widget_show(xs_filt_importselector);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1450 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1451
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1452
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1453 void xs_filter_import_fs_ok(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1454 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1455 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1456 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1457 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1458
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1459 XS_MUTEX_LOCK(xs_cfg);
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1460
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1461 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1462 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
1463 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
1464 xs_cfg_sp2_presets_update();
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1465
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1466 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1467 gtk_widget_destroy(xs_filt_importselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1468 xs_filt_importselector = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1469 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1470 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1471
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1472
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
1473 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
1474 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
1475
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1476
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1477 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data)
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1478 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1479 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1480 (void) user_data;
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1481
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1482 if (xs_filt_exportselector != NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1483 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1484 XS_WINDOW_PRESENT(xs_filt_exportselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1485 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1486 }
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1487
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1488 xs_filt_exportselector = create_xs_filter_export_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1489 gtk_widget_show(xs_filt_exportselector);
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1490 }
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1491
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1492
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1493 void xs_filter_export_fs_ok(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1494 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1495 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1496 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1497 (void) user_data;
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1498
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1499 XS_MUTEX_LOCK(xs_cfg);
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1500
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1501 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1502 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
1503 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
1504
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1505 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1506 gtk_widget_destroy(xs_filt_exportselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1507 xs_filt_exportselector = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1508 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1509 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1510
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1511
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
1512 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
1513 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
1514
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1515
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1516 /* Selection toggle handlers
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1517 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1518 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
1519 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1520 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1521
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1522 (void) user_data;
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1523
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1524 gtk_widget_set_sensitive(LUW("cfg_filters_notebook"), isActive);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1525 }
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1526
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1527
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1528 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
1529 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1530 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1531
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1532 (void) user_data;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1533
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1534 gtk_widget_set_sensitive(LUW("cfg_ftitle_box"), isActive);
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1535 }
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1536
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1537
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1538 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
1539 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1540 (void) togglebutton;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1541 (void) user_data;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1542 }
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1543
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1544
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1545 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
1546 {
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1547 gboolean isSP2Active = GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay2"))->active,
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1548 isFPActive = GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplayfp"))->active,
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1549 isEither = isSP2Active || isFPActive;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1550
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1551 (void) togglebutton;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1552 (void) user_data;
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1553
848
a293b88eb3fb Disable some configuration options in the dialog when using FP backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 839
diff changeset
1554 gtk_widget_set_sensitive(LUW("cfg_memmode_frame"), !isFPActive);
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1555 gtk_widget_set_sensitive(LUW("cfg_emu_mem_real"), isSP2Active);
848
a293b88eb3fb Disable some configuration options in the dialog when using FP backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 839
diff changeset
1556
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1557 gtk_widget_set_sensitive(LUW("cfg_sidplay2_frame"), isEither);
712
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1558
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1559 /* Optimization mode removed from distortion patch */
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1560 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_opt"), isSP2Active);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1561
886
5d4677af3c8e Disable autopan output option also when using FP backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 874
diff changeset
1562 gtk_widget_set_sensitive(LUW("cfg_chn_autopan"), !isEither);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1563
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1564 #if defined(HAVE_SIDPLAYFP) && defined(HAVE_RESID_FP_BUILDER)
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1565 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid_fp"), isFPActive);
793
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1566 #else
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1567 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid_fp"), FALSE);
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1568 #endif
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1569
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1570 #ifdef HAVE_RESID_BUILDER
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1571 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), isEither);
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
1572 gtk_widget_set_sensitive(LUW("cfg_resid_frame"), isFPActive);
793
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1573 #else
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1574 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), FALSE);
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
1575 gtk_widget_set_sensitive(LUW("cfg_resid_frame"), FALSE);
793
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1576 #endif
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1577
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1578 #ifdef HAVE_HARDSID_BUILDER
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1579 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), isEither);
793
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1580 #else
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1581 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), FALSE);
793
0617f844ebdb Meh, revert some previous changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
1582 #endif
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
1583
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1584 }
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1585
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1586
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1587 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
1588 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1589 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1590
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1591 (void) user_data;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1592
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1593 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
1594 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1595
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1596
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1597 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
1598 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1599 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
1600
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1601 (void) togglebutton;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1602 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1603
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1604 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
1605 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
1606 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1607
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1608
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1609 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
1610 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1611 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
1612
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1613 (void) user_data;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1614
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1615 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
1616 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1617
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1618
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1619 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
1620 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1621 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1622
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1623 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1624
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1625 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
1626 gtk_widget_set_sensitive(LUW("cfg_stil_box2"), isActive);
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1627 }
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1628
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1629
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1630 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
1631 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1632 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1633
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1634 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1635
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1636 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
1637 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
1638 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1639
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1640
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1641 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
1642 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1643 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active &&
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1644 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
1645
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1646 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1647
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1648 gtk_widget_set_sensitive(LUW("cfg_subauto_box"), isActive);
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1649 }
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1650
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1651
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1652 void xs_cfg_mintime_changed(GtkEditable * editable, gpointer user_data)
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1653 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1654 gint tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1655 GtkAdjustment *tmpAdj;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1656
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1657 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1658
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1659 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
1660
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1661 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
1662
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1663 if (tmpValue > tmpAdj->value)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1664 gtk_adjustment_set_value(tmpAdj, tmpValue);
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1665 }
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1666
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1667
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1668 void xs_cfg_maxtime_changed(GtkEditable * editable, gpointer user_data)
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1669 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1670 gint tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1671 GtkAdjustment *tmpAdj;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1672
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1673 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1674
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1675 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
1676
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1677 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
1678
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1679 if (tmpValue < tmpAdj->value)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1680 gtk_adjustment_set_value(tmpAdj, tmpValue);
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1681 }
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1682
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1683
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1684 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
1685
fdddab8f0c1b Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
1686
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1687 /* Execute the configuration panel
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1688 */
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1689 void xs_configure(void)
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1690 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1691 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1692 gfloat tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1693 gchar tmpStr[64];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1694 GList *tmpList = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1695 GtkWidget *tmpCurve;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1696
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1697 /* Check if the window already exists */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1698 if (xs_configwin)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1699 {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1700 XS_WINDOW_PRESENT(xs_configwin);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1701 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1702 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1703
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1704 /* Create the window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1705 xs_configwin = create_xs_configwin();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1706
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1707 /* Get lock on configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1708 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
1709
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1710 /* Add samplerates */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1711 for (i = 0; i < xs_nsamplerates_table; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1712 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1713 tmpList = g_list_append (tmpList,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1714 (gpointer) xs_samplerates_table[i]);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1715 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1716 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
1717 g_list_free(tmpList);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1718
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1719 /* Create the custom filter curve widget for libSIDPlay2 */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1720 xs_cfg_sp2_presets_update();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1721 tmpCurve = xs_curve_new();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1722 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
1723 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
1724 gtk_widget_ref(tmpCurve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1725 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
1726 "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
1727 gtk_widget_show(tmpCurve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1728 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
1729
349
b5e54614b35a More unused argument warning removal, bit of code for filter editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
1730
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1731 /* 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
1732 #ifndef HAVE_SIDPLAY1
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1733 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
1734 gtk_widget_set_sensitive(LUW("cfg_box_filter_sidplay1"), FALSE);
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
1735 #endif
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
1736
850
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1737 #ifndef HAVE_SIDPLAY2
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1738 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2"), FALSE);
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1739 #endif
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1740 #ifndef HAVE_SIDPLAYFP
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1741 gtk_widget_set_sensitive(LUW("cfg_emu_sidplayfp"), FALSE);
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1742 #endif
82e759a5c7e6 Disable FP backend item in configuration when not available.
Matti Hamalainen <ccr@tnsp.org>
parents: 848
diff changeset
1743
839
29f3c3f29c0d Finalize libSIDPlay2 vs FP configuration stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 831
diff changeset
1744 #if !defined(HAVE_SIDPLAY2) && !defined(HAVE_SIDPLAYFP)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1745 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
1746 #endif
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
1747
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
1748
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1749 #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
1750 gtk_widget_set_sensitive(LUW("cfg_subctrl_patch"), FALSE);
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1751 #endif
647
3833592748eb Fixed configuration dialog, thanks to Joker for pointing out the flaws.
Matti Hamalainen <ccr@tnsp.org>
parents: 643
diff changeset
1752
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1753 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
1754 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
1755 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
1756 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
1757 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
1758 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
1759 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
1760 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
1761 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
1762 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
1763
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1764
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1765 /* Set current data to widgets */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1766 for (i = 0; i < xs_nwidtable; i++)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1767 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1768 switch (xs_cfgitems[i].widType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1769 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1770 case WTYPE_BGROUP:
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1771 assert(xs_cfgitems[i].itemType == CTYPE_INT);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1772 /* Check if current value matches the given one */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1773 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName)),
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1774 (*((gint *) xs_cfgitems[i].itemData) == xs_cfgitems[i].itemSet));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1775 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
1776
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1777 case WTYPE_COMBO:
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1778 assert(xs_cfgitems[i].itemType == CTYPE_INT);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1779 g_snprintf(tmpStr, sizeof(tmpStr), "%d", *(gint *) xs_cfgitems[i].itemData);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1780 gtk_entry_set_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)), tmpStr);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1781 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1782
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1783 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1784 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1785 /* Get the value */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1786 switch (xs_cfgitems[i].itemType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1787 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1788 case CTYPE_INT:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1789 tmpValue = (gfloat) * ((gint *) xs_cfgitems[i].itemData);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1790 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1791
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1792 case CTYPE_FLOAT:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1793 tmpValue = *((gfloat *) xs_cfgitems[i].itemData);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1794 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1795
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1796 default:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1797 tmpValue = -1;
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1798 assert(0);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1799 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1800 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1801
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1802 /* Set the value */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1803 switch (xs_cfgitems[i].widType)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1804 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1805 case WTYPE_SPIN:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1806 gtk_adjustment_set_value(gtk_spin_button_get_adjustment
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1807 (GTK_SPIN_BUTTON(LUW(xs_cfgitems[i].widName))), tmpValue);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1808 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1809
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1810 case WTYPE_SCALE:
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1811 gtk_adjustment_set_value(gtk_range_get_adjustment
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1812 (GTK_RANGE(LUW(xs_cfgitems[i].widName))), tmpValue);
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1813 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1814 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1815 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1816
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1817 case WTYPE_BUTTON:
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1818 assert(xs_cfgitems[i].itemType == CTYPE_BOOL);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1819 /* Set toggle-button */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1820 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName)),
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1821 *((gboolean *) xs_cfgitems[i].itemData));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1822 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1823
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1824 case WTYPE_TEXT:
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1825 assert(xs_cfgitems[i].itemType == CTYPE_STR);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1826 /* Set text to text-widget */
785
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1827 if (*(gchar **) xs_cfgitems[i].itemData != NULL)
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1828 {
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1829 gtk_entry_set_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)),
fcda6f365e02 More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 773
diff changeset
1830 *(gchar **) xs_cfgitems[i].itemData);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1831 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1832 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1833 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1834 }
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
1835
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1836 /* Release the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1837 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
1838
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1839 /* Show the widget */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1840 gtk_widget_show(xs_configwin);
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1841 }