Plan 9 from Bell Labs’s /usr/web/sources/extra/art/selection.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "art.h"

/*
 * Code for manipulating the selection
 */
Item *selection;
Image *color, *sel, *background;

void setselection(Item *p){
	if(selection==p) return;
	/*
	 * This should be done differently in the brave new non-xor world
	 * but it appears to involve redrawing everything when the selection changes
	 */
	drawsel();
	selection=p;
	drawsel();
	redraw();		/*redundant?? */
}
/*
 * It would be nice if this were faster
 */
void drawselprim(Item *ip, Item *op){
	(*ip->fn->artdraw)(ip, sel, color);
}
void drawsel(void){
	if(selection==0) return;
	rectf(sel, sel->r, background);		/* set color to paint background  */

	walk(selection, scoffs, drawselprim);
	draw(sel, Rpt(subpt(screen->r.min, Pt(1, 0)), screen->r.max), sel, 0, ZP);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].