shithub: choc

Download patch

ref: 4780944f27780ad8287b39df3209076d6bce90ce
parent: bb764b8ec9e35b0228b9de142bf5b54b13e52630
author: Simon Howard <fraggle@soulsphere.org>
date: Wed Jul 8 17:24:43 EDT 2015

setup: Fix population of extra_table.

There was a bug here where if the user switched to eg. OPL and then
to "Disabled", the OPL type selector would still remain visible.
Fix UpdateExtraTable() to always clear the table before populating
it with new contents.

--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -186,36 +186,40 @@
 {
     TXT_CAST_ARG(txt_table_t, extra_table);
 
+    TXT_ClearTable(extra_table);
+
     switch (snd_musicmode)
     {
-    case MUSICMODE_OPL:
-        TXT_InitTable(extra_table, 2);
-        TXT_SetColumnWidths(extra_table, 19, 4);
-        TXT_AddWidgets(extra_table,
-                        TXT_NewLabel("OPL type"),
-                        OPLTypeSelector(),
-                        NULL);
-        break;
+        case MUSICMODE_OPL:
+            TXT_SetColumnWidths(extra_table, 19, 4);
+            TXT_AddWidgets(extra_table,
+                           TXT_NewLabel("OPL type"),
+                           OPLTypeSelector(),
+                           NULL);
+            break;
 
-    case MUSICMODE_GUS:
-        TXT_InitTable(extra_table, 1);
-        TXT_AddWidgets(extra_table,
-                        TXT_NewLabel("GUS patch path:"),
-                        TXT_NewFileSelector(&gus_patch_path, 30,
-                                            "Select path to GUS patches",
-                                            TXT_DIRECTORY),
-                        NULL);
-        break;
+        case MUSICMODE_GUS:
+            TXT_AddWidgets(extra_table,
+                           TXT_NewLabel("GUS patch path:"),
+                           TXT_NewStrut(0, 0),
+                           TXT_NewFileSelector(&gus_patch_path, 30,
+                                               "Select path to GUS patches",
+                                               TXT_DIRECTORY),
+                           NULL);
+            break;
 
-    case MUSICMODE_NATIVE:
-        TXT_InitTable(extra_table, 1);
-        TXT_AddWidgets(extra_table,
-                        TXT_NewLabel("Timidity configuration file:"),
-                        TXT_NewFileSelector(&timidity_cfg_path, 30,
-                                            "Select Timidity config file",
-                                            cfg_extension),
-                        NULL);
-        break;
+        case MUSICMODE_NATIVE:
+            TXT_AddWidgets(extra_table,
+                           TXT_NewLabel("Timidity configuration file:"),
+                           TXT_NewStrut(0, 0),
+                           TXT_NewFileSelector(&timidity_cfg_path, 30,
+                                               "Select Timidity config file",
+                                               cfg_extension),
+                           NULL);
+            break;
+
+        default:
+            break;
     }
 }
 
@@ -329,7 +333,7 @@
     TXT_AddWidgets(window,
                TXT_NewSeparator("Music"),
                music_table = TXT_NewTable(2),
-               extra_table = TXT_NewTable(1),
+               extra_table = TXT_NewTable(2),
                NULL);
 
     TXT_SetColumnWidths(music_table, 19, 15);