Esempio n. 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;
	}	}
}
Esempio n. 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");
}
Esempio n. 3
0
void
putgrid(int p)
{	int i;

	for (i = p ; i >= 0; i--)
	{	if (!ProcLine[i])
		{	psline(i, 0, i, MH-1, (float) (0.4), (float) (0.4), (float) (1.0), 1);
			ProcLine[i] = 1;
	}	}
}
Esempio n. 4
0
static void
colbox(int ix, int iy, int w, int h, char *color)
{	int x = ix*WW;
	int y = iy*HH;

	if (ix < 0 || ix > 255)
	{	fatal("msc_tcl: unexpected\n", (char *) 0);
	}

	if (ProcLine[ix] < iy)
	{	/* if (ProcLine[ix] > 0) */
		{	psline(ix-1, ProcLine[ix]*HH+HH+4,
			       ix-1, iy*HH-HH, "lightgrey");
		}
		fprintf(pfd, "# ProcLine[%d] from %d to %d (Used %d nobox %d)\n",
			ix, ProcLine[ix], iy, UsedLine[ix], no_box);
		ProcLine[ix] = iy;
	} else
	{	fprintf(pfd, "# ProcLine[%d] stays at %d (Used %d nobox %d)\n",
			ix, ProcLine[ix], UsedLine[ix], no_box);
	}

	if (UsedLine[ix])
	{	no_box = 2;
	}

	if (strcmp(color, "black") == 0)
	{	if (no_box == 0)	/* shadow */
		{	fprintf(pfd, ".c create rectangle %d %d %d %d -fill black\n",
				xscale*x-(xscale*4*w/3)-20+4, (yscale*y-10)+20+2,
				xscale*x+(xscale*4*w/3)-20,   (yscale*y+10)+20+2);
		}
	} else
	{	if (no_box == 0)	/* box with outline */
		{	fprintf(pfd, ".c create rectangle %d %d %d %d -fill ivory\n",
				xscale*x-(xscale*4*w/3)-20, (yscale*y-10)+20,
				xscale*x+(xscale*4*w/3)-20, (yscale*y+10)+20);
			UsedLine[ix]++;
		} else			/* no outline */
		{	fprintf(pfd, ".c create rectangle %d %d %d %d -fill white -width 0\n",
				xscale*x-(xscale*4*w/3)-20, (yscale*y-10)+20,
				xscale*x+(xscale*4*w/3)-20, (yscale*y+10)+20);
	}	}
	if (no_box > 0)
	{	no_box--;
	}
}