tMetaserver list columns are now resized so that the server names and comments can be read properly. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8bf3b0a8c834ea2074124279975d4833dbfc5f82
(DIR) parent 61f1eeb80a2a626f950eee098a361f30e8038200
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Wed, 10 Jul 2002 17:45:52 +0000
Metaserver list columns are now resized so that the server names and comments
can be read properly.
Diffstat:
M src/gtkport/clist.c | 11 ++++++++++-
M src/gtkport/clist.h | 1 +
M src/gui_client/newgamedia.c | 10 +++++++++-
3 files changed, 20 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/src/gtkport/clist.c b/src/gtkport/clist.c
t@@ -180,7 +180,7 @@ void gtk_clist_realize(GtkWidget *widget)
SendMessage(header, HDM_LAYOUT, 0, (LPARAM)&hdl);
clist->header_size = wp.cy;
widget->hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "",
- WS_CHILD | WS_TABSTOP | LBS_DISABLENOSCROLL
+ WS_CHILD | WS_TABSTOP | WS_HSCROLL
| WS_VSCROLL | LBS_OWNERDRAWFIXED |
LBS_NOTIFY, 0, 0, 0, 0, Parent, NULL,
hInst, NULL);
t@@ -509,6 +509,15 @@ void gtk_clist_set_column_width_full(GtkCList *clist, gint column,
}
}
+gint gtk_clist_optimal_column_width(GtkCList *clist, gint column)
+{
+ if (clist && column >= 0 && column < clist->cols) {
+ return clist->coldata[column].width;
+ } else {
+ return 0;
+ }
+}
+
void gtk_clist_set_selection_mode(GtkCList *clist, GtkSelectionMode mode)
{
clist->mode = mode;
(DIR) diff --git a/src/gtkport/clist.h b/src/gtkport/clist.h
t@@ -76,6 +76,7 @@ void gtk_clist_set_column_title(GtkCList *clist, gint column,
gint gtk_clist_insert(GtkCList *clist, gint row, gchar *text[]);
gint gtk_clist_set_text(GtkCList *clist, gint row, gint col, gchar *text);
void gtk_clist_set_column_width(GtkCList *clist, gint column, gint width);
+gint gtk_clist_optimal_column_width(GtkCList *clist, gint column);
void gtk_clist_column_title_passive(GtkCList *clist, gint column);
void gtk_clist_column_titles_passive(GtkCList *clist);
void gtk_clist_column_title_active(GtkCList *clist, gint column);
(DIR) diff --git a/src/gui_client/newgamedia.c b/src/gui_client/newgamedia.c
t@@ -185,7 +185,7 @@ static void FillMetaServerList(gboolean UseNewList)
ServerData *ThisServer;
gchar *titles[5];
GSList *ListPt;
- gint row;
+ gint row, width;
if (UseNewList && !stgam.NewMetaList)
return;
t@@ -222,6 +222,14 @@ static void FillMetaServerList(gboolean UseNewList)
if (ThisServer->CurPlayers != -1)
g_free(titles[3]);
}
+ if (MetaList) {
+ width = gtk_clist_optimal_column_width(GTK_CLIST(metaserv), 4);
+ gtk_clist_set_column_width(GTK_CLIST(metaserv), 4, width);
+ width = gtk_clist_optimal_column_width(GTK_CLIST(metaserv), 3);
+ gtk_clist_set_column_width(GTK_CLIST(metaserv), 3, width);
+ width = gtk_clist_optimal_column_width(GTK_CLIST(metaserv), 0);
+ gtk_clist_set_column_width(GTK_CLIST(metaserv), 0, width);
+ }
gtk_clist_thaw(GTK_CLIST(metaserv));
}