Mercurial > pidgin.yaz
changeset 18354:d5d1c12a5ad4
Remove some duplication, and make the slider a little nicer.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 29 Jun 2007 06:30:53 +0000 |
parents | caa25e0ff358 |
children | cafecb0e4147 |
files | finch/libgnt/gntslider.c |
diffstat | 1 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/gntslider.c Fri Jun 29 04:57:01 2007 +0000 +++ b/finch/libgnt/gntslider.c Fri Jun 29 06:30:53 2007 +0000 @@ -70,11 +70,9 @@ int position, size = 0; if (slider->vertical) - mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), - (size = widget->priv.height)); + size = widget->priv.height; else - mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), - (size = widget->priv.width)); + size = widget->priv.width; if (gnt_widget_has_focus(widget)) attr |= GNT_COLOR_HIGHLIGHT; @@ -85,10 +83,22 @@ position = ((size - 1) * (slider->current - slider->min)) / (slider->max - slider->min); else position = 0; + if (slider->vertical) { + mvwvline(widget->window, size-position, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD, + position); + mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + size-position); + } else { + mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD, + position); + mvwhline(widget->window, 0, position, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + size - position); + } + mvwaddch(widget->window, slider->vertical ? (size - position - 1) : 0, slider->vertical ? 0 : position, - ACS_BLOCK | COLOR_PAIR(attr)); + ACS_CKBOARD | COLOR_PAIR(attr)); } static void @@ -117,10 +127,7 @@ GntSlider *slider = GNT_SLIDER(bindable); if (slider->current <= slider->min) return FALSE; - slider->current -= slider->step; - sanitize_value(slider); - redraw_slider(slider); - slider_value_changed(slider); + gnt_slider_advance_step(slider, -1); return TRUE; } @@ -130,10 +137,7 @@ GntSlider *slider = GNT_SLIDER(bindable); if (slider->current >= slider->max) return FALSE; - slider->current += slider->step; - sanitize_value(slider); - redraw_slider(slider); - slider_value_changed(slider); + gnt_slider_advance_step(slider, 1); return TRUE; }