summaryrefslogtreecommitdiff
path: root/textscreen
diff options
context:
space:
mode:
authorSimon Howard2008-02-04 22:43:11 +0000
committerSimon Howard2008-02-04 22:43:11 +0000
commit65ed2a3208db93eef0f25f5d9c046c77cb7eb980 (patch)
treee109a340f85128a24922e6c485d4df48d56d4dc8 /textscreen
parentaff2bd33f46df242be24e9f75e9ef1a2a6d9184f (diff)
downloadchocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.tar.gz
chocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.tar.bz2
chocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.zip
Update chocolate-setup to the new screen mode config system.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1042
Diffstat (limited to 'textscreen')
-rw-r--r--textscreen/txt_table.c19
-rw-r--r--textscreen/txt_table.h1
2 files changed, 16 insertions, 4 deletions
diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c
index 8b31af24..29798906 100644
--- a/textscreen/txt_table.c
+++ b/textscreen/txt_table.c
@@ -33,14 +33,18 @@
#include "txt_strut.h"
#include "txt_table.h"
-static void TXT_TableDestructor(TXT_UNCAST_ARG(table))
+// Remove all entries from a table
+
+void TXT_ClearTable(TXT_UNCAST_ARG(table))
{
TXT_CAST_ARG(txt_table_t, table);
int i;
// Free all widgets
+ // Skip over the first (num_columns) widgets in the array, as these
+ // are the column struts used to control column width
- for (i=0; i<table->num_widgets; ++i)
+ for (i=table->columns; i<table->num_widgets; ++i)
{
if (table->widgets[i] != NULL)
{
@@ -48,9 +52,16 @@ static void TXT_TableDestructor(TXT_UNCAST_ARG(table))
}
}
- // Free table resources
+ // Shrink the table to just the column strut widgets
+
+ table->num_widgets = table->columns;
+}
+
+static void TXT_TableDestructor(TXT_UNCAST_ARG(table))
+{
+ TXT_CAST_ARG(txt_table_t, table);
- free(table->widgets);
+ TXT_ClearTable(table);
}
static int TableRows(txt_table_t *table)
diff --git a/textscreen/txt_table.h b/textscreen/txt_table.h
index c3a3c5a8..d42e9adb 100644
--- a/textscreen/txt_table.h
+++ b/textscreen/txt_table.h
@@ -53,6 +53,7 @@ void TXT_AddWidget(TXT_UNCAST_ARG(table), TXT_UNCAST_ARG(widget));
void TXT_AddWidgets(TXT_UNCAST_ARG(table), ...);
int TXT_SelectWidget(TXT_UNCAST_ARG(table), TXT_UNCAST_ARG(widget));
void TXT_SetColumnWidths(TXT_UNCAST_ARG(table), ...);
+void TXT_ClearTable(TXT_UNCAST_ARG(table));
#endif /* #ifndef TXT_TABLE_T */