tWhen displaying high scores, the score from the current game is displayed in a different colour. - 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 99ca4cc4a185dfe52e70aef61872a5a708871386
(DIR) parent 39386c9a043c1d52435bcba4b40a047cd6f0982e
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Mon, 18 Mar 2002 13:17:42 +0000
When displaying high scores, the score from the current game is displayed
in a different colour.
Diffstat:
M src/gui_client/gtk_client.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/gui_client/gtk_client.c b/src/gui_client/gtk_client.c
t@@ -576,6 +576,7 @@ void AddScoreToDialog(char *Data)
gchar **spl1, **spl2;
int index, slen;
gboolean bold;
+ GtkStyle *style = NULL;
if (!HiScoreDialog.dialog)
return;
t@@ -604,6 +605,16 @@ void AddScoreToDialog(char *Data)
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(HiScoreDialog.table), label,
0, 1, index, index + 1);
+ if (bold) {
+ GdkColor color;
+
+ color.red = 0;
+ color.green = 0;
+ color.blue = 0xDDDD;
+ style = gtk_style_new();
+ style->fg[GTK_STATE_NORMAL] = color;
+ gtk_widget_set_style(label, style);
+ }
gtk_widget_show(label);
/* Remove any leading whitespace from the remainder, since g_strsplit
t@@ -621,6 +632,8 @@ void AddScoreToDialog(char *Data)
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
gtk_table_attach_defaults(GTK_TABLE(HiScoreDialog.table), label,
1, 2, index, index + 1);
+ if (bold)
+ gtk_widget_set_style(label, style);
gtk_widget_show(label);
/* The remainder is the name, terminated with (R.I.P.) if the player
t@@ -640,6 +653,8 @@ void AddScoreToDialog(char *Data)
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
gtk_table_attach_defaults(GTK_TABLE(HiScoreDialog.table), label,
3, 4, index, index + 1);
+ if (bold)
+ gtk_widget_set_style(label, style);
gtk_widget_show(label);
spl2[1][slen - 8] = '\0'; /* Remove suffix from the player name */
}
t@@ -650,6 +665,8 @@ void AddScoreToDialog(char *Data)
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(HiScoreDialog.table), label,
2, 3, index, index + 1);
+ if (bold)
+ gtk_widget_set_style(label, style);
gtk_widget_show(label);
g_strfreev(spl1);