Mercurial > pidgin
diff finch/libgnt/gnttree.c @ 21250:9187d331aebe
Add gnt_color_pair, which will replace color codes with 'appropriate' text
attributes if the terminal doesn't support color. Fixes #3560.
I have included the output of diffstat of the changeset. Do we like this in
our commit message? If we do, we can use the stuff rekkanoryo has for gf.
----------------------------------------------------------------------
ChangeLog.API | 7 +++++++
finch/libgnt/gntbox.c | 10 +++++-----
finch/libgnt/gntbutton.c | 3 ++-
finch/libgnt/gntcheckbox.c | 4 ++--
finch/libgnt/gntcolors.c | 11 +++++++++++
finch/libgnt/gntcolors.h | 13 +++++++++++++
finch/libgnt/gntcombobox.c | 8 ++++----
finch/libgnt/gntentry.c | 4 ++--
finch/libgnt/gntline.c | 4 ++--
finch/libgnt/gntmain.c | 4 ++--
finch/libgnt/gntmenu.c | 4 ++--
finch/libgnt/gntslider.c | 10 +++++-----
finch/libgnt/gnttextview.c | 14 +++++++-------
finch/libgnt/gnttree.c | 37 ++++++++++++++++++-------------------
finch/libgnt/gntwidget.c | 22 +++++++++++-----------
finch/libgnt/gntwm.c | 4 ++--
finch/libgnt/gntws.c | 10 +++++-----
17 files changed, 100 insertions(+), 69 deletions(-)
| author | Sadrul Habib Chowdhury <imadil@gmail.com> |
|---|---|
| date | Tue, 16 Oct 2007 09:51:12 +0000 |
| parents | fe77cc691f78 |
| children | f35b480841dc |
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c Tue Oct 16 04:14:54 2007 +0000 +++ b/finch/libgnt/gnttree.c Tue Oct 16 09:51:12 2007 +0000 @@ -432,7 +432,7 @@ tree_selection_changed(tree, NULL, tree->current); } - wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL)); start = 0; if (tree->show_title) @@ -440,9 +440,9 @@ int i; int x = pos; - mvwhline(widget->window, pos + 1, pos, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, pos + 1, pos, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width - pos - 1); - mvwhline(widget->window, pos, pos, ' ' | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, pos, pos, ' ' | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width - pos - 1); for (i = 0; i < tree->ncol; i++) @@ -455,14 +455,14 @@ } if (pos) { - tree_mark_columns(tree, pos, 0, ACS_TTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + tree_mark_columns(tree, pos, 0, ACS_TTEE | gnt_color_pair(GNT_COLOR_NORMAL)); tree_mark_columns(tree, pos, widget->priv.height - pos, - ACS_BTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_BTEE | gnt_color_pair(GNT_COLOR_NORMAL)); } tree_mark_columns(tree, pos, pos + 1, - (tree->show_separator ? ACS_PLUS : ACS_HLINE) | COLOR_PAIR(GNT_COLOR_NORMAL)); + (tree->show_separator ? ACS_PLUS : ACS_HLINE) | gnt_color_pair(GNT_COLOR_NORMAL)); tree_mark_columns(tree, pos, pos, - (tree->show_separator ? ACS_VLINE : ' ') | COLOR_PAIR(GNT_COLOR_NORMAL)); + (tree->show_separator ? ACS_VLINE : ' ') | gnt_color_pair(GNT_COLOR_NORMAL)); start = 2; } @@ -514,18 +514,18 @@ if (row == tree->current) { if (gnt_widget_has_focus(widget)) - attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT); + attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT); else - attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D); + attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT_D); } else { if (flags & GNT_TEXT_FLAG_DIM) - attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED)); + attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED)); else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) - attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); else - attr |= COLOR_PAIR(GNT_COLOR_NORMAL); + attr |= gnt_color_pair(GNT_COLOR_NORMAL); } wbkgdset(widget->window, '\0' | attr); @@ -537,7 +537,7 @@ (tree->show_separator ? ACS_VLINE : ' ') | attr); } - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); while (i < widget->priv.height - pos) { mvwhline(widget->window, i, pos, ' ', @@ -576,22 +576,22 @@ position += pos + start + 1; mvwvline(widget->window, pos + start + 1, scrcol, - ' ' | COLOR_PAIR(GNT_COLOR_NORMAL), rows); + ' ' | gnt_color_pair(GNT_COLOR_NORMAL), rows); mvwvline(widget->window, position, scrcol, - ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing); + ACS_CKBOARD | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D), showing); } mvwaddch(widget->window, start + pos, scrcol, ((tree->top != tree->root) ? ACS_UARROW : ' ') | - COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); mvwaddch(widget->window, widget->priv.height - pos - 1, scrcol, - (row ? ACS_DARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + (row ? ACS_DARROW : ' ') | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); /* If there's a search-text, show it in the bottom of the tree */ if (tree->priv->search && tree->priv->search->len > 0) { const char *str = gnt_util_onscreen_width_to_pointer(tree->priv->search->str, scrcol - 1, NULL); - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); mvwaddnstr(widget->window, widget->priv.height - pos - 1, pos, tree->priv->search->str, str - tree->priv->search->str); } @@ -1328,7 +1328,6 @@ tree->list = g_list_insert(tree->list, key, position + 1); } } - redraw_tree(tree); return row;
