pidgin: a3fcf6b6: Change how the progressbar is drawn.

sadrul at pidgin.im sadrul at pidgin.im
Sun Apr 12 17:10:46 EDT 2009


-----------------------------------------------------------------
Revision: a3fcf6b6728fc0318165820ec38a4d0cba65556c
Ancestor: 87f2579885da43bff8d15abbec544b0e6c9071e6
Author: sadrul at pidgin.im
Date: 2009-04-12T20:55:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a3fcf6b6728fc0318165820ec38a4d0cba65556c

Modified files:
        finch/libgnt/gntprogressbar.c

ChangeLog: 

Change how the progressbar is drawn.
Don't highlight the progress-bar ... because it looks weird when the
window is not in focus.

-------------- next part --------------
============================================================
--- finch/libgnt/gntprogressbar.c	e179318dddca301e19f7063e0e8f2a27441ea089
+++ finch/libgnt/gntprogressbar.c	ab83a0a5419130ebb42c516368d83a927dceddc9
@@ -55,8 +55,10 @@ gnt_progress_bar_draw (GntWidget *widget
 	GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (GNT_PROGRESS_BAR (widget));
 	gchar progress[8];
 	gint start, end, i, pos;
+	int color;
 
 	g_snprintf (progress, sizeof (progress), "%.1f%%", priv->fraction * 100);
+	color = gnt_color_pair(GNT_COLOR_NORMAL);
 
 	switch (priv->orientation) {
 		case GNT_PROGRESS_LEFT_TO_RIGHT:
@@ -66,20 +68,20 @@ gnt_progress_bar_draw (GntWidget *widget
 
 			/* background */
 			for (i = 0; i < widget->priv.height; i++)
-				mvwhline (widget->window, i, 0, ' ' | gnt_color_pair (GNT_COLOR_HIGHLIGHT) | A_REVERSE, widget->priv.width);
+				mvwhline (widget->window, i, 0, ' ' | color, widget->priv.width);
 
 			/* foreground */
 			for (i = 0; i < widget->priv.height; i++)
-				mvwhline (widget->window, i, start, ' ' | gnt_color_pair (GNT_COLOR_HIGHLIGHT), end);
+				mvwhline (widget->window, i, start, ACS_CKBOARD | color | A_REVERSE, end);
 
 			/* text */
 			if (priv->show_value) {
-				for (i = 0; i < strlen(progress); i++) {
-					pos = widget->priv.width / 2 - strlen (progress) / 2 + i;
-					wattrset (widget->window, gnt_color_pair (GNT_COLOR_HIGHLIGHT) | ((pos >= start && pos <= end) ? A_NORMAL : A_REVERSE));
+				pos = widget->priv.width / 2 - strlen (progress) / 2;
+				for (i = 0; i < progress[i]; i++, pos++) {
+					wattrset (widget->window, color | ((pos < start || pos > end) ? A_NORMAL : A_REVERSE));
 					mvwprintw (widget->window, widget->priv.height / 2, pos, "%c", progress[i]);
 				}
-				wattrset (widget->window, gnt_color_pair (GNT_COLOR_HIGHLIGHT));
+				wattrset (widget->window, color);
 			}
 
 			break;
@@ -90,20 +92,20 @@ gnt_progress_bar_draw (GntWidget *widget
 
 			/* background */
 			for (i = 0; i < widget->priv.width; i++)
-				mvwvline (widget->window, 0, i, ' ' | gnt_color_pair (GNT_COLOR_HIGHLIGHT) | A_REVERSE, widget->priv.height);
+				mvwvline (widget->window, 0, i, ' ' | color | A_REVERSE, widget->priv.height);
 
 			/* foreground */
 			for (i = 0; i < widget->priv.width; i++)
-				mvwvline (widget->window, start, i, ' ' | gnt_color_pair (GNT_COLOR_HIGHLIGHT), end);
+				mvwvline (widget->window, start, i, ' ' | color, end);
 
 			/* text */
 			if (priv->show_value) {
-				for (i = 0; i < strlen(progress); i++) {
-					pos = widget->priv.height / 2 - strlen (progress) / 2 + i;
-					wattrset (widget->window, gnt_color_pair (GNT_COLOR_HIGHLIGHT) | ((pos >= start && pos <= end) ? A_NORMAL : A_REVERSE));
+				pos = widget->priv.height / 2 - strlen (progress) / 2;
+				for (i = 0; i < progress[i]; i++, pos++) {
+					wattrset (widget->window, color | ((pos >= start && pos <= end) ? A_NORMAL : A_REVERSE));
 					mvwprintw (widget->window, pos, widget->priv.width / 2, "%c\n", progress[i]);
 				}
-				wattrset (widget->window, gnt_color_pair (GNT_COLOR_HIGHLIGHT));
+				wattrset (widget->window, color);
 			}
 
 			break;


More information about the Commits mailing list