foxygit / doom Log in
commit 31a58552ffc647d2c87b557441d3725c6fba2b37
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Oct 20 22:00:46 2011 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Oct 20 22:00:46 2011 +0000

    Use TXT_MessageBox where appropriate.

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2446
---
 src/setup/execute.c        | 10 +++-------
 src/setup/mainmenu.c       |  4 +---
 src/setup/txt_joybinput.c  | 22 ++--------------------
 src/setup/txt_keyinput.c   | 12 +-----------
 src/setup/txt_mouseinput.c | 12 +-----------
 5 files changed, 8 insertions(+), 52 deletions(-)

diff --git a/src/setup/execute.c b/src/setup/execute.c
index f85b8af4..96a14fae 100644
--- a/src/setup/execute.c
+++ b/src/setup/execute.c
@@ -370,14 +370,10 @@ static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data))
     char *main_cfg;
     char *extra_cfg;
     txt_window_t *testwindow;
-    txt_label_t *label;

-    testwindow = TXT_NewWindow("Starting Doom");
-
-    label = TXT_NewLabel("Starting Doom to test the\n"
-                         "settings.  Please wait.");
-    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
-    TXT_AddWidget(testwindow, label);
+    testwindow = TXT_MessageBox("Starting Doom",
+                                "Starting Doom to test the\n"
+                                "settings.  Please wait.");
     TXT_DrawDesktop();

     // Save temporary configuration files with the current configuration
diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c
index 46a53d6e..4256c408 100644
--- a/src/setup/mainmenu.c
+++ b/src/setup/mainmenu.c
@@ -100,9 +100,7 @@ static int MainMenuKeyPress(txt_window_t *window, int key, void *user_data)
             SensibleDefaults();
             cheat_sequence_index = 0;

-            window = TXT_NewWindow(NULL);
-            TXT_AddWidget(window, TXT_NewLabel("    \x01    "));
-            TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
+            window = TXT_MessageBox(NULL, "    \x01    ");

             return 1;
         }
diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c
index 9ad26a45..97aaca94 100644
--- a/src/setup/txt_joybinput.c
+++ b/src/setup/txt_joybinput.c
@@ -76,22 +76,12 @@ static void PromptWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(joystick))

 static void OpenErrorWindow(void)
 {
-    txt_window_t *window;
-
-    window = TXT_NewWindow(NULL);
-
-    TXT_AddWidget(window, TXT_NewLabel("Please configure a joystick first!"));
-
-    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
-                        TXT_NewWindowEscapeAction(window));
-    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
+    TXT_MessageBox(NULL, "Please configure a joystick first!");
 }

 static void OpenPromptWindow(txt_joystick_input_t *joystick_input)
 {
     txt_window_t *window;
-    txt_label_t *label;
     SDL_Joystick *joystick;

     // Silently update when the shift button is held down.
@@ -115,16 +105,8 @@ static void OpenPromptWindow(txt_joystick_input_t *joystick_input)

     // Open the prompt window

-    window = TXT_NewWindow(NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
-                        TXT_NewWindowAbortAction(window));
-    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
-
-    label = TXT_NewLabel("Press the new joystick button...");
+    window = TXT_MessageBox(NULL, "Press the new joystick button...");

-    TXT_AddWidget(window, label);
-    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
     TXT_SDL_SetEventCallback(EventCallback, joystick_input);
     TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick);
     joystick_input->prompt_window = window;
diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c
index 6f1ee4dd..47e782be 100644
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -70,22 +70,12 @@ static void ReleaseGrab(TXT_UNCAST_ARG(window), TXT_UNCAST_ARG(unused))
 static void OpenPromptWindow(txt_key_input_t *key_input)
 {
     txt_window_t *window;
-    txt_label_t *label;

     // Silently update when the shift button is held down.

     key_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);

-    window = TXT_NewWindow(NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
-                        TXT_NewWindowAbortAction(window));
-    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
-
-    label = TXT_NewLabel("Press the new key...");
-
-    TXT_AddWidget(window, label);
-    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
+    window = TXT_MessageBox(NULL, "Press the new key...");

     TXT_SetKeyListener(window, KeyPressCallback, key_input);

diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c
index c3e17299..c45bdc2e 100644
--- a/src/setup/txt_mouseinput.c
+++ b/src/setup/txt_mouseinput.c
@@ -56,21 +56,11 @@ static int MousePressCallback(txt_window_t *window,
 static void OpenPromptWindow(txt_mouse_input_t *mouse_input)
 {
     txt_window_t *window;
-    txt_label_t *label;

     // Silently update when the shift key is held down.
     mouse_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);

-    window = TXT_NewWindow(NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
-    TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
-                        TXT_NewWindowAbortAction(window));
-    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
-
-    label = TXT_NewLabel("Press the new mouse button...");
-
-    TXT_AddWidget(window, label);
-    TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER);
+    window = TXT_MessageBox(NULL, "Press the new mouse button...");

     TXT_SetMouseListener(window, MousePressCallback, mouse_input);
 }