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