Example #1
0
void	drawparttl(TextList *tl,int item)
{
    int	xmin = tl->xmin+8, xmax = tl->xmax-8-SLIDERWIDTH;
    int	ymin = 
		tl->ymin+5+(tl->listheight - item + tl->top - 1)*TEXTHEIGHT;
    int 	ymax = ymin + TEXTHEIGHT - 3;
    char        **s;

    if (!getvisibletl(tl) || !getitemvisibletl(tl,item))
	return;

    s = &tl->strs[item];
    drawsetup();

    uifrontbuffer(1);

    uiLtGray();
    	uirectfi(xmin-1, ymin-1, xmax+1, ymax+1);

    font(TEXTLISTFONT);
    pushviewport();
    scrmask(xmin-1, xmax+1, ymin-1, ymax+1);
    if (s) {
        xmax = xmin + 7 + strwidth(*s);
        if (item == tl->selecteditem) {
    	    uiWhite();
            	uirectfi(xmin, ymin, xmax, ymax);
        }
        if (item == tl->locateditem) {
    	    uiWhite();
            	uirecti(xmin-1, ymin-1, xmax+1, ymax+1);
            	uirecti(xmin, ymin, xmax, ymax);
        }
    	uiBlack();
            uicmov2i(xmin+4, ymin + 5);
            uicharstr(*s);
    }
    popviewport();

    uifrontbuffer(0);

    drawrestore();
}
Example #2
0
main()
{
	char	dev[20];
	int	i;

	fprintf(stderr,"Enter device: ");
	gets(dev);

	vinit(dev);

	color(BLACK);
	clear();

	/*
	 * Set up two viewports (They actually overlap)
	 */

	viewport(-1.0, 0.3, -1.0, 0.3);
	ortho(-2.0, 5.0, -2.0, 5.0, -2.0, 5.0);
	lookat(0.0, 0.0, 0.0, -3.0, 2.0, -4.0, 0.0);
	/*
	 * Save it 
	 */
	pushviewport();
	pushmatrix();

	viewport(-0.3, 1.0, -0.3, 1.0);
	ortho(-2.0, 5.0, -2.0, 5.0, -2.0, 5.0);
	lookat(0.0, 0.0, 0.0, 3.0, 2.0, -4.0, 0.0);

	textsize(0.4, 0.4);

	/*
	 * patchcurves provides a number of curves in the t and u
	 * directions. patchprecision gives the minimum number of line
	 * segments making up the curves in the t and u directions. The
	 * actual number of linesegments in t or u is equal to the closest
	 * integer multiple of the number of curves, > nsegs, in t or u,
	 * greater than or equal to the number set by patchprecision in u or
	 * t. eg. curves in t will be made up of 21 line segments so that we
	 * can match up the 7 curves in u; curves in u will have 24 as 4 by 5
	 * gives 20.
	 */
	patchcurves(4, 7);
	patchprecision(20, 20);

	for (i = 0; i < 4; i++) {

		axes();


		/*
		 * patchbasis sets the basis matrices for the t and u
		 * functions
		 * 
		 */
		patchbasis(basis[i], basis[i]);

		/* 
		 * Draw with viewport 2
		 */
		move(0.0, 4.0, 0.0);
		drawstr(labels[i]);

		/*
		 * now draw the patches according to the geometry matrices in
		 * x1, y1, and z1, x2, y2, z2.
		 */
		drawhull(x1, y1, z1);
		patch(x1, y1, z1);

		drawhull(x2, y2, z2);
		patch(x2, y2, z2);

		getkey();

		/*
		 * Now with viewport 1
		 */
		popviewport();
		popmatrix();

		axes();

		move(0.0, 4.0, 0.0);
		drawstr(labels[i]);

		/*
		 * now draw the patches according to the geometry matrices in
		 * x1, y1, and z1, x2, y2, z2.
		 */
		drawhull(x1, y1, z1);
		patch(x1, y1, z1);

		drawhull(x2, y2, z2);
		patch(x2, y2, z2);

		getkey();

		/*
		 * Save viewport 1 again and reset to viewport 2
		 */
		pushviewport();
		pushmatrix();

		viewport(-0.3, 1.0, -0.3, 1.0);
		ortho(-1.5, 5.0, -1.5, 5.0, -1.5, 5.0);
		lookat(0.0, 0.0, 0.0, 3.0, 2.0, -4.0, 0.0);

		color(BLACK);
		clear();
	}

	vexit();
}