From 1ba69c88d26b33fbec2af21172bb52ad214b0f2a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 May 2006 15:45:36 +0000 Subject: Clip windows against the workspace boundaries. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 487 --- textscreen/txt_button.c | 9 +++---- textscreen/txt_gui.c | 63 ++++++++++++++++++++++++++++++++++++++-------- textscreen/txt_gui.h | 3 ++- textscreen/txt_separator.c | 11 +++----- 4 files changed, 60 insertions(+), 26 deletions(-) (limited to 'textscreen') diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index ba6f387a..4bf5b9c0 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -23,21 +23,18 @@ static void TXT_ButtonDrawer(txt_widget_t *widget, int w, int selected) TXT_BGColor(TXT_COLOR_BLUE, 0); TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); - TXT_PutChar(' '); + TXT_DrawString(" "); if (selected) { TXT_BGColor(TXT_COLOR_GREY, 0); } - for (i=0; ilabel); ++i) - { - TXT_PutChar(button->label[i]); - } + TXT_DrawString(button->label); for (i=strlen(button->label); i < w-2; ++i) { - TXT_PutChar(' '); + TXT_DrawString(" "); } } diff --git a/textscreen/txt_gui.c b/textscreen/txt_gui.c index d4e9650c..2c58cb9f 100644 --- a/textscreen/txt_gui.c +++ b/textscreen/txt_gui.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: txt_gui.c 486 2006-05-20 15:15:17Z fraggle $ +// $Id: txt_gui.c 487 2006-05-20 15:45:36Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -30,6 +30,7 @@ #include +#include "txt_gui.h" #include "txt_io.h" #include "txt_main.h" @@ -48,6 +49,9 @@ static int borders[4][4] = {0xc0, 0xc4, 0xc1, 0xd9}, }; +#define VALID_X(y) ((y) >= 0 && (y) < TXT_SCREEN_W) +#define VALID_Y(y) ((y) >= 1 && (y) < TXT_SCREEN_H - 1) + void TXT_DrawDesktopBackground(char *title) { int i; @@ -90,8 +94,8 @@ void TXT_DrawDesktopBackground(char *title) TXT_FGColor(TXT_COLOR_BLACK); TXT_BGColor(TXT_COLOR_GREY, 0); - TXT_PutChar(' '); - TXT_Puts(title); + TXT_DrawString(" "); + TXT_DrawString(title); } void TXT_DrawShadow(int x, int y, int w, int h) @@ -108,8 +112,7 @@ void TXT_DrawShadow(int x, int y, int w, int h) for (x1=x; x1= 0 && x1 < TXT_SCREEN_W - && y1 >= 0 && y1 < TXT_SCREEN_H) + if (VALID_X(x1) && VALID_Y(y1)) { p[1] = TXT_COLOR_DARK_GREY; } @@ -129,8 +132,6 @@ void TXT_DrawWindowFrame(char *title, int x, int y, int w, int h) for (y1=y; y1label); ++i) - { - TXT_PutChar(separator->label[i]); - } - - TXT_PutChar(' '); + TXT_DrawString(" "); + TXT_DrawString(separator->label); + TXT_DrawString(" "); } } -- cgit v1.2.3