Ejemplo n.º 1
0
// MW-2011-09-06: [[ Redraw ]] Added 'sprite' option - if true, ink and opacity are not set.
void MCColors::draw(MCDC *dc, const MCRectangle &dirty, bool p_isolated, bool p_sprite)
{
	uint2 xcells;
	uint2 ycells;
	getcells(xcells, ycells);

	uint2 i;
	uint2 j;
	MCRectangle rrect = MCU_reduce_rect(rect, borderwidth);
	MCRectangle trect;
	MCColor c;

	c = dc->getwhite();
	dc->setfillstyle(FillSolid, nil, 0, 0);
	for (i = 0 ; i < ycells ; i++)
		for (j = 0 ; j < xcells ; j++)
		{
			trect.x = j * rrect.width / xcells;
			trect.y = i * rrect.height / ycells;
			trect.width = (j + 1) * rrect.width / xcells - trect.x;
			trect.height = (i + 1) * rrect.height / ycells - trect.y;
			trect.x += rrect.x;
			trect.y += rrect.y;
			MCscreen->getpaletteentry(i * xcells + j, c);
			dc->setforeground(c);
			dc->fillrect(trect);
			if (c.pixel == selectedcolor)
				draw3d(dc, trect, ETCH_SUNKEN, borderwidth);
		}
	if (flags & F_SHOW_BORDER)
		if (flags & F_3D)
			draw3d(dc, rect, ETCH_SUNKEN, borderwidth);
		else
			drawborder(dc, rect, borderwidth);
}
Ejemplo n.º 2
0
void MCEPS::resetscale()
{
	MCRectangle trect = rect;
	if (flags & F_SHOW_BORDER)
		trect = MCU_reduce_rect(trect, borderwidth);
	if (flags & F_SCALE_INDEPENDENTLY)
	{
		xscale = trect.width * xf / ex;
		yscale = trect.height * yf / ey;
	}
	else
	{
		if (trect.width * ey < trect.height * ex)
			xscale = trect.width * xf / ex;
		else
			xscale = trect.height * xf / ey;
		yscale = xscale;
	}
}
Ejemplo n.º 3
0
void MCControl::layer_transientchangedandredrawall(int32_t p_old_transient)
{
	if (!opened)
		return;

	// Check the visibility state of the object.
	bool t_is_visible;
	t_is_visible = isvisible() || MCshowinvisibles;

	// If we are not a sprite, and are invisible there is nothing to do; otherwise
	// we must at least try to dump cached updated parts of the sprite.
	if (!layer_issprite() && !t_is_visible)
		return;

	MCRectangle t_old_effectiverect;
	t_old_effectiverect = MCU_reduce_rect(rect, -p_old_transient);
	if (m_bitmap_effects != nil)
		MCBitmapEffectsComputeBounds(m_bitmap_effects, t_old_effectiverect, t_old_effectiverect);

	layer_changeeffectiverect(t_old_effectiverect, true, t_is_visible);
}
Ejemplo n.º 4
0
void MCStack::constrain(intptr_t lp)
{
	uint32_t wstyle, exstyle;
	getstyle(wstyle, exstyle);
	RECT wrect = getwrect(rect, wstyle, exstyle);
	int4 dx = wrect.right - wrect.left - rect.width;
	int4 dy = wrect.bottom - wrect.top - rect.height;
	LPMINMAXINFO mmptr = (LPMINMAXINFO)lp;
	const MCDisplay *t_display;
	t_display = MCscreen -> getnearestdisplay(rect);

	if (mode < WM_MODAL)
	{
		MCRectangle t_workarea, t_viewport;
		if (MCU_point_in_rect(t_display -> workarea, MCwbr . x, MCwbr . y))
			t_workarea = MCU_intersect_rect(MCwbr, t_display -> workarea);
		else
			t_workarea = t_display -> workarea;
		t_viewport = t_display -> viewport;

		if (memcmp(&t_workarea, &t_display -> workarea, sizeof(MCRectangle)))
			MCU_reduce_rect(t_workarea, -dx / 2);

		mmptr -> ptMaxSize . x = MCU_min(maxwidth + dx, t_workarea . width);
		mmptr -> ptMaxSize . y = MCU_min(maxheight + dy, t_workarea . height);
		mmptr -> ptMaxPosition . x = t_workarea . x - t_viewport . x;
		mmptr -> ptMaxPosition . y = t_workarea . y - t_viewport . y;
	}

	// MW-2007-07-27: In Windows 98 we need to clamp to 32767...
	
	mmptr -> ptMinTrackSize . x = minwidth + dx;
	mmptr -> ptMinTrackSize . y = minheight + dy;
	mmptr -> ptMaxTrackSize . x = MCU_min(32767, maxwidth + dx);
	mmptr -> ptMaxTrackSize . y = MCU_min(32767, maxheight + dy);

}
Ejemplo n.º 5
0
// MW-2011-09-06: [[ Redraw ]] Added 'sprite' option - if true, ink and opacity are not set.
void MCEPS::draw(MCDC *dc, const MCRectangle &dirty, bool p_isolated, bool p_sprite)
{
	MCRectangle trect = rect;
	if (flags & F_SHOW_BORDER)
		trect = MCU_reduce_rect(trect, borderwidth);

	if (flags & F_OPAQUE)
	{
		setforeground(dc, DI_BACK, False);
		dc->fillrect(trect);
	}
	if (state & (CS_SIZE | CS_MOVE))
	{
		dc->setlineatts(0, LineDoubleDash, CapButt, JoinBevel);
		dc->setforeground(dc->getblack());
		dc->setbackground(dc->getwhite());
		dc->setfillstyle(FillSolid, nil, 0, 0);
		dc->setdashes(0, dashlist, 2);
		MCLineSegment segs[2];
		segs[0].x1 = segs[1].x1 = trect.x;
		segs[0].x2 = segs[1].x2 = trect.x + trect.width;
		segs[0].y1 = segs[1].y2 = trect.y;
		segs[0].y2 = segs[1].y1 = trect.y + trect.height;
		dc->drawsegments(segs, 2);
		dc->setlineatts(0, LineSolid, CapButt, JoinBevel);
		dc->setbackground(MCzerocolor);
	}

#ifdef HAVE_EPS
	else
	{
		const char *psprolog = postscript;
		uint4 psprologlength = 0;
		const char *ps;
		uint4 length;
		if ((pagecount == 0) || (pagecount == 1))
		{
			ps = postscript;
			length = strlen(postscript);
		}
		else
		{
			psprologlength = pageIndex[0];
			ps = &postscript[pageIndex[curpage - 1] - 1];
			if (curpage != pagecount)
				length = pageIndex[curpage] - pageIndex[curpage - 1];
			else
				length = size - pageIndex[curpage - 1];
		}
		setforeground(dc, DI_FORE, False);
		const char *fontname;
		uint2 fheight, fontsize, fontstyle;
		MCFontStruct *font;
		getfontatts(fontname, fheight, fontsize, fontstyle, font);
		dc->draweps(trect.x * xf, -(trect.y * yf), angle, xscale, yscale,
		            tx, ty, prolog, psprolog, psprologlength, ps, length,
		            fontname, fontsize, fontstyle, font, trect);
	}
#endif

	if (flags & F_SHOW_BORDER)
		trect = MCU_reduce_rect(trect, -borderwidth);
	if (flags & F_SHOW_BORDER)
		if (flags & F_3D)
			draw3d(dc, trect, ETCH_SUNKEN, borderwidth);
		else
			drawborder(dc, trect, borderwidth);
	if (getstate(CS_KFOCUSED))
		drawfocus(dc, dirty);
	if (state & CS_SELECTED)
		drawselected(dc);
}
Ejemplo n.º 6
0
MCRectangle MCPlayer::getactiverect(void)
{
	return MCU_reduce_rect(getrect(), getflag(F_SHOW_BORDER) ? borderwidth : 0);
}