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

(mgp-users 00575) Re: side-by-side positioning



On Mon, May 21, 2001 at 11:38:45PM +0900, William Sherman -Visualization wrote:
> [...]
> I was thinking "%again" jumped to the x,y
> location where the "%mark" command was given.  But maybe it only jumps
> to the y location?  And now that I think about it, I recall having to
> jump through some hoops to jump to a previous x,y location using "%again"
> and a bunch of spaces -- so maybe there needs to be a "%xyagain" command.
> 
You'll find a patch attached to this email which introduces numerical
arguments to the 'mark' and 'again' commands. I fixed it to a maximum of 10
at the moment (it's a 'define' in  mgp.h) so that you can use '0' to '9' as
labels. Both the xoffset and the y-position are (re-)stored.

The patch includes the 'xoffset' and the 'multiple-mark' patch as the
second one depends on the first one.

The markers are all set back to (0,0) on viewing a new page but the the
verification, if the marker given to 'again' has been actually set before
with 'mark' is not being done anymore. It jumps to 0,0 then.

Regards
Chris

-- 
Dipl.-Inf. Christopher Drexler, Lehrst.f. Mustererkennung _    __  __ ___ 
Institut f. Informatik, Universitaet Erlangen-Nuernberg  | |  |  \/  | __|
WWW : http://www5.informatik.uni-erlangen.de/~drexler  	 | |__| |\/| | _| 
GPG : http://www.keyserver.net                           |____|_|  |_|___|
Index: draw.c
===================================================================
RCS file: /cvsmgp/kit/draw.c,v
retrieving revision 1.185
diff -r1.185 draw.c
260a261
> 	int i;
262c263,266
< 	state->have_mark = 0;
---
>  	state->xoffset = 0;
> 	for(i = 0; i<MARK_MAX_SAVE; i++) {
> 		state->mark_xpos[i] = state->mark_ypos[i] = 0;
> 	}
470a475,478
> 	case CTL_XOFFSET:
> 		state->xoffset = state->width * cp->ctf_value / 100;
> 		break;
> 
503,505c511,519
< 		if (state->have_mark)
< 			state->ypos = state->mark_ypos;
< 		state->have_mark = 0;
---
> 		if ( cp->cti_value > MARK_MAX_SAVE-1 ||
> 		     cp->cti_value < 0 	) {
> 			fprintf(stderr,
> 			"invalid marker \"%d\" (range is \"0\"-\"%d\")\n",
> 				cp->cti_value, MARK_MAX_SAVE-1);
> 			break;
> 		}
> 		state->ypos	= state->mark_ypos[cp->cti_value];
> 		state->xoffset 	= state->mark_xpos[cp->cti_value];
705,706c719,727
< 		state->have_mark = 1;
< 		state->mark_ypos = state->ypos;
---
> 		if ( cp->cti_value > MARK_MAX_SAVE-1 ||
> 		     cp->cti_value < 0 	) {
> 			fprintf(stderr,
> 			"invalid marker \"%d\" (range is \"0\"-\"%d\")\n",
> 				cp->cti_value, MARK_MAX_SAVE-1);
> 			break;
> 		}
> 		state->mark_ypos[cp->cti_value] = state->ypos;
> 		state->mark_xpos[cp->cti_value] = state->xoffset;
1837a1859
> 	xpos += state->xoffset; 
3394c3416
< 	xloc = set_position(state);
---
> 	xloc = set_position(state) + state->xoffset;
Index: globals.c
===================================================================
RCS file: /cvsmgp/kit/globals.c,v
retrieving revision 1.44
diff -r1.44 globals.c
149a150
> /*CTL*/	{ CTL_XOFFSET,		T_DOUBLE, "xoffset", 7 },
Index: grammar.y
===================================================================
RCS file: /cvsmgp/kit/grammar.y,v
retrieving revision 1.37
diff -r1.37 grammar.y
700c700,701
< %token KW_CHARSET KW_TMFONT KW_PCACHE KW_TMFONT0 KW_ANIM KW_VALIGN
---
> %token KW_CHARSET KW_TMFONT KW_PCACHE KW_TMFONT0 KW_ANIM KW_VALIGN 
> %token KW_XOFFSET
763,764c764,767
< 	| KW_AGAIN	{ $$ = gen_void(CTL_AGAIN); }
< 	| KW_MARK	{ $$ = gen_void(CTL_MARK); }
---
> 	| KW_AGAIN NUM	{ $$ = gen_int(CTL_AGAIN, $2); }
> 	| KW_AGAIN	{ $$ = gen_int(CTL_AGAIN, 0); }
> 	| KW_MARK NUM	{ $$ = gen_int(CTL_MARK, $2); }
> 	| KW_MARK	{ $$ = gen_int(CTL_MARK, 0); }
765a769,770
> 	| KW_XOFFSET NUM	{ $$ = gen_double_int(CTL_XOFFSET, $2); }
> 	| KW_XOFFSET DOUBLE	{ $$ = gen_double(CTL_XOFFSET, $2); }
Index: mgp.h
===================================================================
RCS file: /cvsmgp/kit/mgp.h,v
retrieving revision 1.126
diff -r1.126 mgp.h
383,384c383,386
< 	int have_mark;
< 	u_int mark_ypos;
---
>  	u_int xoffset;
> #define MARK_MAX_SAVE 10
> 	u_int mark_xpos[MARK_MAX_SAVE];
> 	u_int mark_ypos[MARK_MAX_SAVE];
Index: scanner.l
===================================================================
RCS file: /cvsmgp/kit/scanner.l,v
retrieving revision 1.21
diff -r1.21 scanner.l
166a167
> (XOFFSET|xoffset)	return KW_XOFFSET;

Attachment: pgp8Zq0jFCbMS.pgp
Description: PGP signature