From 344823214b77a076351e1101a89e8c2a407dca48 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 19 May 2006 19:57:59 +0000 Subject: Split off text mode gui desktop code into a separate file. Rename some of the functions in txt_gui.c. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 483 --- textscreen/txt_window.c | 64 +++++-------------------------------------------- 1 file changed, 6 insertions(+), 58 deletions(-) (limited to 'textscreen/txt_window.c') diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index cc467192..819bdc34 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -25,38 +25,12 @@ #include #include +#include "txt_desktop.h" #include "txt_gui.h" +#include "txt_main.h" #include "txt_separator.h" #include "txt_window.h" -#define MAXWINDOWS 128 - -static char *desktop_title; -static txt_window_t *all_windows[MAXWINDOWS]; -static int num_windows = 0; - -static void AddWindow(txt_window_t *win) -{ - all_windows[num_windows] = win; - ++num_windows; -} - -static void RemoveWindow(txt_window_t *win) -{ - int from, to; - - for (from=0, to=0; fromnum_widgets = 0; win->selected = 0; - AddWindow(win); + TXT_AddDesktopWindow(win); return win; } @@ -92,7 +66,7 @@ void TXT_CloseWindow(txt_window_t *window) free(window->title); free(window); - RemoveWindow(window); + TXT_RemoveDesktopWindow(window); } static void TXT_WindowSize(txt_window_t *window, int *w, int *h) @@ -115,7 +89,7 @@ static void TXT_WindowSize(txt_window_t *window, int *w, int *h) *h = window->num_widgets; } -static void DrawWindow(txt_window_t *window) +void TXT_DrawWindow(txt_window_t *window) { int widgets_w, widgets_h; int window_w, window_h; @@ -138,7 +112,7 @@ static void DrawWindow(txt_window_t *window) // Draw the window - TXT_DrawWindow(window->title, window_x, window_y, window_w, window_h); + TXT_DrawWindowFrame(window->title, window_x, window_y, window_w, window_h); // Draw all widgets @@ -153,32 +127,6 @@ static void DrawWindow(txt_window_t *window) TXT_DrawSeparator(window_x, window_y + 2 + window->num_widgets, window_w); } -void TXT_SetDesktopTitle(char *title) -{ - free(desktop_title); - desktop_title = strdup(title); -} - -void TXT_DrawAllWindows(void) -{ - int i; - char *title; - - if (desktop_title == NULL) - title = ""; - else - title = desktop_title; - - TXT_DrawDesktop(title); - - for (i=0; i