Mercurial > hg
changeset 1761:61f0482d3993
Limit = alignment to 1/3 of screen in option list
* Add scr_gettextwidth()
* Use it to limit alignment of equal sign in option list
to one third of available message width
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Sat, 13 Mar 2010 18:12:47 +0200 |
parents | 106bbf7e97da |
children | e7ce50fe19a9 |
files | mcabber/mcabber/commands.c mcabber/mcabber/screen.c mcabber/mcabber/screen.h |
diffstat | 3 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c Sat Mar 13 16:19:46 2010 +0200 +++ b/mcabber/mcabber/commands.c Sat Mar 13 18:12:47 2010 +0200 @@ -2103,14 +2103,20 @@ settings_foreach(SETTINGS_TYPE_OPTION, list_option_cb, &list); if (list) { gsize max = 0; + gsize maxmax = scr_gettextwidth() / 3; GSList *lel; gchar *format; // Find out maximum key length for (lel = list; lel; lel = lel->next) { const gchar *key = lel->data; gsize len = strlen(key); - if (len > max) + if (len > max) { max = len; + if (max > maxmax) { + max = maxmax; + break; + } + } } // Print out list of options format = g_strdup_printf("%%-%us = [%%s]", max);
--- a/mcabber/mcabber/screen.c Sat Mar 13 16:19:46 2010 +0200 +++ b/mcabber/mcabber/screen.c Sat Mar 13 18:12:47 2010 +0200 @@ -846,6 +846,11 @@ return timepreflengths[(n < 3 ? n : 0)]; } +guint scr_gettextwidth(void) +{ + return maxX - Roster_Width - scr_getprefixwidth(); +} + // scr_print_logwindow(string) // Display the string in the log window. // Note: The string must be in the user's locale!
--- a/mcabber/mcabber/screen.h Sat Mar 13 16:19:46 2010 +0200 +++ b/mcabber/mcabber/screen.h Sat Mar 13 18:12:47 2010 +0200 @@ -118,6 +118,7 @@ const char *scr_get_multimode_subj(void); guint scr_getprefixwidth(void); +guint scr_gettextwidth(void); void scr_line_prefix(hbb_line *line, char *prefix, guint preflen); void scr_Beep(void);