[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users 01109] timebar weirdness



The timebar doesn't appear in the right place in the window for me. This
patch makes it work as expected.

--- draw.c~	Mon Sep 17 14:48:29 2001
+++ draw.c	Wed Jan 22 17:02:20 2003
@@ -2994,39 +2994,39 @@
 	if (t_start == 0 || tbar_mode == 0 || caching)
 		return;
 
-	pos = (state->width - 2) * (state->page - 1) / (maxpage - 1);
-	p = (time(NULL) - t_start) * 100;
-	barlen = state->width - state->width * p / t_fin / 6000;
+	pos = (window_width - 2) * (state->page - 1) / (maxpage - 1);
+	p = time(NULL) - t_start;
+	barlen = window_width - window_width * p / t_fin / 60;
 
-	if (state->width * 50 / 100 < barlen)
+	if (window_width / 2 < barlen)
 		pgc = &gcgreen;
-	else if (state->width * 30 / 100 < barlen)
+	else if (window_width / 3 < barlen)
 		pgc = &gcyellow;
 	else
 		pgc = &gcred;
 	if (barlen > 0) {
-		XClearArea(display, state->target, 0, state->height - 2,
-			state->width, 2, 0);
+		XClearArea(display, state->target, 0, window_height - 2,
+			window_width, 2, 0);
 		XFillRectangle(display, state->target, *pgc,
-			state->width - barlen, state->height - 1, barlen, 1);
+			window_width - barlen, window_height - 1, barlen, 1);
 		XFillRectangle(display, state->target, *pgc,
-			pos, state->height - 5, 2, 5);
+			pos, window_height - 5, 2, 5);
 	} else if (barlen < 0) {
 		barlen = - barlen;
-		n = p / t_fin / 6000;
-		if (n > state->height - 1)
-			n = state->height - 1;
+		n = p / t_fin / 60;
+		if (n > window_height - 1)
+			n = window_height - 1;
 		if (n)
 			XFillRectangle(display, state->target, gcred,
-				0, state->height - n,
+				0, window_height - n,
 				barlen, n);
-		XClearArea(display, state->target, 0, state->height - (n + 2),
-			state->width, n + 2, 0);
+		XClearArea(display, state->target, 0, window_height - (n + 2),
+			window_width, n + 2, 0);
 		XFillRectangle(display, state->target, gcred,
-			0, state->height - (n + 1),
-			barlen % state->width, n + 1);
+			0, window_height - (n + 1),
+			barlen % window_width, n + 1);
 		XFillRectangle(display, state->target, gcred,
-			pos, state->height - (n + 1 + 4),
+			pos, window_height - (n + 1 + 4),
 			2, 5);
 	}
 }

Tony.
-- 
f.a.n.finch  <dot@dotat.at>  http://dotat.at/
THE MULL OF GALLOWAY TO MULL OF KINTYRE INCLUDING THE FIRTH OF CLYDE AND THE
NORTH CHANNEL: NORTHWEST 5 OR 6 LOCALLY 7 DECREASING 3 OR 4, BACKING
SOUTHWEST, INCREASING 5 OR 6.