Exemple #1
0
static void
putpages(void)
{	int i, lasti=0; float nmh;

	if (maxx*xscale*WW > MW-RH/2)
	{	Scaler = (float) (MW-RH/2) / (float) (maxx*xscale*WW);
		nmh = (float) MH; nmh /= Scaler; MH = (int) nmh;
		fprintf(pfd, "# Scaler %f, MH %d\n", Scaler, MH);
	}
	if (ldepth >= TotSteps)
	{	ldepth = TotSteps-1;
	}

/* W: (maxx+2)*xscale*WW  */
/* H: ldepth*HH*yscale+50 */

	fprintf(pfd, "canvas .c -width 800 -height 800 \\\n");
	fprintf(pfd, "	-scrollregion {0c -1c 30c 100c} \\\n");
	fprintf(pfd, "	-xscrollcommand \".hscroll set\" \\\n");
	fprintf(pfd, "	-yscrollcommand \".vscroll set\" \\\n");
	fprintf(pfd, "	-bg white -relief raised -bd 2\n");

	fprintf(pfd, "scrollbar .vscroll -relief sunken ");
	fprintf(pfd, " -command \".c yview\"\n");
	fprintf(pfd, "scrollbar .hscroll -relief sunken -orient horiz ");
	fprintf(pfd, " -command \".c xview\"\n");

	fprintf(pfd, "pack append . \\\n");
	fprintf(pfd, "	.vscroll {right filly} \\\n");
	fprintf(pfd, "	.hscroll {bottom fillx} \\\n");
	fprintf(pfd, "	.c {top expand fill}\n");

	fprintf(pfd, ".c yview moveto 0\n");

	for (i = TotSteps-1; i >= 0; i--)
	{	if (I[i])
		{	spitbox(i, -1, I[i]);
	}	}

	for (i = 0; i <= ldepth; i++)
	{	if (!M[i] && !L[i])
		{	continue;	/* no box */
		}
		if (T[i] > 0)		/* arrow */
		{	if (T[i] == i)	/* rv handshake */
			{	psline(	M[lasti], lasti*HH,
					M[i],     i*HH,
					"red");
			} else
			{	psline(	M[i],     i*HH,
					M[T[i]],  T[i]*HH,
					"blue");
		}	}
		if (L[i])
		{	spitbox(M[i], i, L[i]);
			lasti = i;
	}	}
}
Exemple #2
0
void
putpages(void)
{	int i, lasti=0; float nmh;

	if (maxx*WW > MW-RH/2)
	{	Scaler = (float) (MW-RH/2) / (float) (maxx*WW);
		fprintf(pfd, "%f %f scale\n", Scaler, Scaler);
		nmh = (float) MH; nmh /= Scaler; MH = (int) nmh;
	}

	for (i = TotSteps-1; i >= 0; i--)
	{	if (!I[i]) continue;
		spitbox(i, 0, 0, I[i]);
	}
	if (ldepth >= TotSteps) ldepth = TotSteps-1;
	for (i = 0; i <= ldepth; i++)
	{	if (!M[i] && !L[i]) continue;	/* no box here */
		if (6+i*HH >= MH*pspno)
		{ fprintf(pfd, "showpage\nrestore\n"); startpage(); }
		if (T[i] > 0)	/* red arrow */
		{	int reali = i*HH;
			int realt = T[i]*HH;
			int topop = (reali)/MH; topop *= MH;
			reali -= topop;  realt -= topop;

			if (M[i] == M[T[i]] && reali == realt)
				/* an rv handshake */
				psline( M[lasti], reali+2-3*HH/2,
					M[i], reali,
					(float) 1.,(float) 0.,(float) 0., 2);
			else
				psline(	M[i],    reali,
					M[T[i]], realt,
					(float) 1.,(float) 0.,(float) 0., 2);

			if (realt >= MH) T[T[i]] = -i;

		} else if (T[i] < 0)	/* arrow from prev page */
		{	int reali = (-T[i])*HH;
			int realt = i*HH;
			int topop = (realt)/MH; topop *= MH;
			reali -= topop;  realt -= topop;

			psline(	M[-T[i]], reali,
				M[i],     realt,
				(float) 1., (float) 0., (float) 0., 2);
		}
		if (L[i])
		{	spitbox(M[i], 0, i, L[i]);
			/* free(L[i]); */
			lasti = i;
		}
	}
	fprintf(pfd, "showpage\nrestore\n");
}
Exemple #3
0
void
startpage(void)
{	int i;

	pspno++;
	fprintf(pfd, "%%%%Page: %d %d\n", pspno, pspno);
	putlegend();

	for (i = TotSteps-1; i >= 0; i--)
	{	if (!I[i]) continue;
		spitbox(i, RH, -PH, I[i]);
	}

	fprintf(pfd, "save\n");
	fprintf(pfd, "10 %d moveto\n", LH+oMH+5);
	fprintf(pfd, "%d %d lineto\n", RH+MW, LH+oMH+5);
	fprintf(pfd, "%d %d lineto\n", RH+MW, LH);
	fprintf(pfd, "10 %d lineto\n", LH);
	fprintf(pfd, "closepath clip newpath\n");
	fprintf(pfd, "%f %f translate\n",
		(float) RH, (float) LH);
	memset(ProcLine, 0, 256*sizeof(char));
	if (Scaler != 1.0)
		fprintf(pfd, "%f %f scale\n", Scaler, Scaler);
}