shithub: choc

Download patch

ref: e339efa45fb54e794d1dd26f7a716a383cc3dc6d
parent: bc087b49e2e5a9c00b5b1620b4bd289ebee5ee73
author: Simon Howard <[email protected]>
date: Tue Mar 22 17:33:17 EDT 2011

Switch separator to show "screen mode" or "window size" depending on
whether fullscreen is turned on or not.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2308

--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@
        with instructions specific to the platform that it is
        targetting.  This should help to avoid confusion that some
        users have reported experiencing.
+     * The display settings window in the setup tool has been
+       reorganised to a better arrangement.
 
     Compatibility:
      * Added support for the alternate version of the Final Doom
@@ -36,6 +38,10 @@
     libtextscreen:
      * It is now possible to type a '+' in input boxes (thanks
        Alexandre Xavier).
+     * It is possible to use the mouse wheel to scroll through scroll
+       panes.
+     * Clicking on scroll bars now moves the scroll handle to a
+       matching location.
 
 1.5.0 (2011-01-02):
 
--- a/setup/display.c
+++ b/setup/display.c
@@ -517,6 +517,21 @@
     GenerateModesTable(NULL, modes_table);
 }
 
+static void UpdateModeSeparator(TXT_UNCAST_ARG(widget),
+                                TXT_UNCAST_ARG(separator))
+{
+    TXT_CAST_ARG(txt_separator_t, separator);
+
+    if (fullscreen)
+    {
+        TXT_SetSeparatorLabel(separator, "Screen mode");
+    }
+    else
+    {
+        TXT_SetSeparatorLabel(separator, "Window size");
+    }
+}
+
 #if defined(_WIN32) && !defined(_WIN32_WCE)
 
 static int use_directx = 1;
@@ -612,9 +627,10 @@
 {
     txt_window_t *window;
     txt_table_t *modes_table;
+    txt_separator_t *modes_separator;
     txt_table_t *bpp_table;
-    txt_checkbox_t *fs_checkbox;
     txt_window_action_t *advanced_button;
+    txt_checkbox_t *fs_checkbox;
     int i;
     int num_columns;
     int num_rows;
@@ -684,11 +700,14 @@
     }
 
     TXT_AddWidgets(window,
-                   TXT_NewSeparator("Screen mode"),
+                   modes_separator = TXT_NewSeparator(""),
                    modes_table,
                    NULL);
 
-    TXT_SignalConnect(fs_checkbox, "changed", GenerateModesTable, modes_table);
+    TXT_SignalConnect(fs_checkbox, "changed",
+                      GenerateModesTable, modes_table);
+    TXT_SignalConnect(fs_checkbox, "changed",
+                      UpdateModeSeparator, modes_separator);
 
     // How many rows high will the configuration window be?
     // Need to take into account number of fullscreen modes, and also
@@ -726,6 +745,7 @@
                                   TXT_SCREEN_W / 2, window_y);
 
     GenerateModesTable(NULL, modes_table);
+    UpdateModeSeparator(NULL, modes_separator);
 
     // Button to open "advanced" window.
     // Need to pass a pointer to the modes table, as some of the options
--- a/textscreen/txt_separator.c
+++ b/textscreen/txt_separator.c
@@ -80,6 +80,20 @@
     free(separator->label);
 }
 
+void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label)
+{
+    free(separator->label);
+
+    if (label != NULL)
+    {
+        separator->label = strdup(label);
+    }
+    else
+    {
+        separator->label = NULL;
+    }
+}
+
 txt_widget_class_t txt_separator_class =
 {
     TXT_NeverSelectable,
@@ -99,14 +113,8 @@
 
     TXT_InitWidget(separator, &txt_separator_class);
 
-    if (label != NULL)
-    {
-        separator->label = strdup(label);
-    }
-    else
-    {
-        separator->label = NULL;
-    }
+    separator->label = NULL;
+    TXT_SetSeparatorLabel(separator, label);
 
     return separator;
 }
--- a/textscreen/txt_separator.h
+++ b/textscreen/txt_separator.h
@@ -59,6 +59,14 @@
 
 txt_separator_t *TXT_NewSeparator(char *label);
 
-#endif /* #ifndef TXT_SEPARATOR_H */
+/**
+ * Change the label on a separator.
+ *
+ * @param separator     The separator.
+ * @param label         The new label.
+ */
 
+void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label);
+
+#endif /* #ifndef TXT_SEPARATOR_H */