From 406c6ab4dfbef3ace867dbe2ffd54072e4e48113 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 1 Apr 2016 09:50:46 +0200 Subject: [PATCH] Replace coord font control for ICS font control In the Fonts the control to set the coord font is removed, as the Cairo version currently ignores the -coordFont setting. Instead a control to set the font in the ICS Console is added. As the fonts there are controlled by tags, and would ignoe the global font setting of the widget, the font tag is redefined through a kludgy call of AppendColorized with a NULL string as text. This is now interpreted as a signalfor recreating the font tag based on the current icsFont, which will then only be applied to future messages. --- dialogs.c | 6 ++++-- gtk/xoptions.c | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dialogs.c b/dialogs.c index fe8f8cc..11a3be3 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1627,7 +1627,7 @@ static void AdjustFont P((int n)); static int FontsOK (int n) { - extern Option historyOptions[], engoutOptions[], gamesOptions[]; + extern Option historyOptions[], engoutOptions[], gamesOptions[], chatOptions[]; int i; DisplayBothClocks(); ApplyFont(&mainOptions[W_MESSG], NULL); @@ -1637,6 +1637,8 @@ FontsOK (int n) ApplyFont(&engoutOptions[5], NULL); ApplyFont(&engoutOptions[12], NULL); ApplyFont(&gamesOptions[0], NULL); + ApplyFont(&chatOptions[11], appData.icsFont); + AppendColorized(&chatOptions[6], NULL, 0); // kludge to replace font tag DrawPosition(TRUE, NULL); // for coord font return 1; } @@ -1652,7 +1654,7 @@ static Option fontOptions[] = { { 2, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("-") }, { 3, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("B") }, { 4, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("I") }, - { 0, 60, 70, NULL, (void*) &appData.coordFont, NULL, NULL, TextBox, N_("Board coordinates:") }, + { 0, 60, 70, NULL, (void*) &appData.icsFont, NULL, NULL, TextBox, N_("ICS Chat/Console:") }, { 1, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("+") }, { 2, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("-") }, { 3, SAME_ROW, 0, NULL, (void*) &AdjustFont, NULL, NULL, Button, N_("B") }, diff --git a/gtk/xoptions.c b/gtk/xoptions.c index c4c4bd7..3a29431 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -615,6 +615,11 @@ AppendColorized (Option *opt, char *s, int count) static GtkTextIter end; static GtkTextTag *fgTags[8], *bgTags[8], *font, *bold, *normal, *attr = NULL; + if(!s) { + font = NULL; + return; + } + if(!font) { font = gtk_text_buffer_create_tag(opt->handle, NULL, "font", appData.icsFont, NULL); gtk_widget_modify_base(GTK_WIDGET(opt->textValue), GTK_STATE_NORMAL, &backgroundColor); -- 1.7.0.4