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

[mgp-users 01113] Re: timebar weirdness



Hi, 
Thanks for notice. 
The timebar doesn't appear correctly in my environment, either.
I will check your patch and commit it soon.
--
Yoshifumi Nishida
nishida@csl.sony.co.jp

From: Tony Finch <dot@dotat.at>
Subject: [mgp-users 01109] timebar weirdness
Date: Wed, 22 Jan 2003 17:19:41 +0000
Message-ID: <>

dot> The timebar doesn't appear in the right place in the window for me. This
dot> patch makes it work as expected.
dot> 
dot> --- draw.c~	Mon Sep 17 14:48:29 2001
dot> +++ draw.c	Wed Jan 22 17:02:20 2003
dot> @@ -2994,39 +2994,39 @@
dot>  	if (t_start == 0 || tbar_mode == 0 || caching)
dot>  		return;
dot>  
dot> -	pos = (state->width - 2) * (state->page - 1) / (maxpage - 1);
dot> -	p = (time(NULL) - t_start) * 100;
dot> -	barlen = state->width - state->width * p / t_fin / 6000;
dot> +	pos = (window_width - 2) * (state->page - 1) / (maxpage - 1);
dot> +	p = time(NULL) - t_start;
dot> +	barlen = window_width - window_width * p / t_fin / 60;
dot>  
dot> -	if (state->width * 50 / 100 < barlen)
dot> +	if (window_width / 2 < barlen)
dot>  		pgc = &gcgreen;
dot> -	else if (state->width * 30 / 100 < barlen)
dot> +	else if (window_width / 3 < barlen)
dot>  		pgc = &gcyellow;
dot>  	else
dot>  		pgc = &gcred;
dot>  	if (barlen > 0) {
dot> -		XClearArea(display, state->target, 0, state->height - 2,
dot> -			state->width, 2, 0);
dot> +		XClearArea(display, state->target, 0, window_height - 2,
dot> +			window_width, 2, 0);
dot>  		XFillRectangle(display, state->target, *pgc,
dot> -			state->width - barlen, state->height - 1, barlen, 1);
dot> +			window_width - barlen, window_height - 1, barlen, 1);
dot>  		XFillRectangle(display, state->target, *pgc,
dot> -			pos, state->height - 5, 2, 5);
dot> +			pos, window_height - 5, 2, 5);
dot>  	} else if (barlen < 0) {
dot>  		barlen = - barlen;
dot> -		n = p / t_fin / 6000;
dot> -		if (n > state->height - 1)
dot> -			n = state->height - 1;
dot> +		n = p / t_fin / 60;
dot> +		if (n > window_height - 1)
dot> +			n = window_height - 1;
dot>  		if (n)
dot>  			XFillRectangle(display, state->target, gcred,
dot> -				0, state->height - n,
dot> +				0, window_height - n,
dot>  				barlen, n);
dot> -		XClearArea(display, state->target, 0, state->height - (n + 2),
dot> -			state->width, n + 2, 0);
dot> +		XClearArea(display, state->target, 0, window_height - (n + 2),
dot> +			window_width, n + 2, 0);
dot>  		XFillRectangle(display, state->target, gcred,
dot> -			0, state->height - (n + 1),
dot> -			barlen % state->width, n + 1);
dot> +			0, window_height - (n + 1),
dot> +			barlen % window_width, n + 1);
dot>  		XFillRectangle(display, state->target, gcred,
dot> -			pos, state->height - (n + 1 + 4),
dot> +			pos, window_height - (n + 1 + 4),
dot>  			2, 5);
dot>  	}
dot>  }
dot> 
dot> Tony.
dot> -- 
dot> f.a.n.finch  <dot@dotat.at>  http://dotat.at/
dot> THE MULL OF GALLOWAY TO MULL OF KINTYRE INCLUDING THE FIRTH OF CLYDE AND THE
dot> NORTH CHANNEL: NORTHWEST 5 OR 6 LOCALLY 7 DECREASING 3 OR 4, BACKING
dot> SOUTHWEST, INCREASING 5 OR 6.
dot>