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