Ejemplo n.º 1
0
void MCPlayer::timer(MCNameRef mptr, MCParameter *params)
{
    if (MCNameIsEqualToCaseless(mptr, MCM_play_stopped))
    {
        state |= CS_PAUSED;
        if (isbuffering()) //so the last frame gets to be drawn
        {
            // MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
            layer_redrawall();
        }
        if (disposable)
        {
            playstop();
            return; //obj is already deleted, do not pass msg up.
        }
    }
    else if (MCNameIsEqualToCaseless(mptr, MCM_play_paused))
    {
        state |= CS_PAUSED;
        if (isbuffering()) //so the last frame gets to be drawn
        {
            // MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
            layer_redrawall();
        }
    }
	MCControl::timer(mptr, params);
}
Ejemplo n.º 2
0
Exec_stat MCColors::setprop_legacy(uint4 parid, Properties p, MCExecPoint &ep, Boolean effective)
{
	Boolean dirty = True;
	MCString data = ep.getsvalue();

	switch (p)
	{
#ifdef /* MCColors::setprop */ LEGACY_EXEC
	case P_SELECTED_COLOR:
	{
		MCColor color;
		char *colorname = NULL;
		if (!MCscreen->parsecolor(data, &color, &colorname))
		{
			MCeerror->add
			(EE_COLOR_BADSELECTEDCOLOR, 0, 0, data);
			return ES_ERROR;
		}
		if (colorname != NULL)
			delete colorname;
		MCscreen->alloccolor(color);
		selectedcolor = color.pixel;
	}
        break;
#endif /* MCColors::setprop */
	default:
		return MCControl::setprop_legacy(parid, p, ep, effective);
	}
	if (dirty && opened)
	{
		// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
		layer_redrawall();
	}
	return ES_NORMAL;
}
Ejemplo n.º 3
0
void MCControl::Redraw(void)
{
	if (!opened)
		return;
	
	// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
	layer_redrawall();
}
Ejemplo n.º 4
0
void MCImage::setframe(int32_t p_newframe)
{
	// MW-2013-03-12: [[ Bug ]] Make sure we check we have a parent (an MCImage can have its frame set on
	//   startup via the templateImage which has no parent).
	MCStack *t_stack;
	t_stack = getstack();
	if (t_stack != nil && t_stack->getstate(CS_EFFECT))
		return;

	uindex_t t_framecount = 0;
	if (m_rep != nil)
		t_framecount = m_rep->GetFrameCount();

	// IM-2013-03-11: [[ BZ 10723 ]] if there is no image data or there is only one frame then currentframe should be zero
	if (t_framecount <= 1)
	{
		currentframe = 0;
		return;
	}

	if (p_newframe < 0)
		p_newframe = 0;
	else if (p_newframe >= t_framecount)
		p_newframe = t_framecount - 1;

	if (p_newframe == currentframe)
		return;

	currentframe = p_newframe;

	notifyneeds(false);

	// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
	// MW-2011-11-15: [[ Bug 9863 ]] Only invalidate the whole object if it has an
	//   owner!
	if (parent)
		layer_redrawall();
	}
Ejemplo n.º 5
0
Boolean MCColors::mdown(uint2 which)
{
	if (state & CS_MFOCUSED)
		return False;
	state |= CS_MFOCUSED;
	MCColor color;
	switch (which)
	{
	case Button1:
		switch (getstack()->gettool(this))
		{
		case T_BROWSE:
			uint2 xcells;
			uint2 ycells;
			getcells(xcells, ycells);
			MCscreen->getpaletteentry((my - rect.y) * ycells / rect.height * xcells
			                          + (mx - rect.x) * xcells / rect.width, color);
			selectedcolor = color.pixel;
			// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
			layer_redrawall();
			message_with_valueref_args(MCM_mouse_down, MCSTR("1"));
			break;
		case T_POINTER:
			start(True);
			break;
		default:
			return False;
		}
		break;
	case Button2:
	case Button3:
		message_with_args(MCM_mouse_down, which);
		break;
	}
	return True;
}
Ejemplo n.º 6
0
Exec_stat MCEPS::setprop_legacy(uint4 parid, Properties p, MCExecPoint &ep, Boolean effective)
{
	Boolean dirty = True;
	real8 n;
	int2 i;
	int2 i1, i2, i3, i4;
	MCString data = ep.getsvalue();

	switch (p)
	{
#ifdef /* MCEPS::setprop */ LEGACY_EXEC
	case P_TRAVERSAL_ON:
	case P_SHOW_BORDER:
		if (MCControl::setprop(parid, p, ep, effective) != ES_NORMAL)
			return ES_ERROR;
		resetscale();
		break;
	case P_ANGLE:
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		angle = i;
		break;
	case P_POSTSCRIPT:
		delete postscript;
		postscript = data.clone();
		size = data.getlength() + 1;
		setextents();
		resetscale();
		break;
	case P_PROLOG:
		delete prolog;
		prolog = data.clone();
		break;
	case P_RETAIN_IMAGE:
		if (!MCU_matchflags(data, flags, F_RETAIN_IMAGE, dirty))
		{
			MCeerror->add
			(EE_OBJECT_NAB, 0, 0, data);
			return ES_ERROR;
		}
		dirty = False;
		break;
	case P_RETAIN_POSTSCRIPT:
		if (!MCU_matchflags(data, flags, F_RETAIN_POSTSCRIPT, dirty))
		{
			MCeerror->add
			(EE_OBJECT_NAB, 0, 0, data);
			return ES_ERROR;
		}
		dirty = False;
		break;
	case P_SCALE_INDEPENDENTLY:
		if (!MCU_matchflags(data, flags, F_SCALE_INDEPENDENTLY, dirty))
		{
			MCeerror->add
			(EE_OBJECT_NAB, 0, 0, data);
			return ES_ERROR;
		}
		if (dirty)
			resetscale();
		break;
	case P_BOUNDING_RECT:
		if (!MCU_stoi2x4(data, i1, i2, i3, i4))
		{
			MCeerror->add
			(EE_OBJECT_NAR, 0, 0, data);
			return ES_ERROR;
		}
		if (tx != i1 || ty != i2 || tx + ex != i3 || ty + ey != i4)
		{
			tx = i1;
			ty = i2;
			ex = MCU_max(i3 - i1, 1);
			ey = MCU_max(i4 - i2, 1);
			resetscale();
		}
		else
			dirty = False;
		break;
	case P_SCALE:
		if (!MCU_stor8(data, n))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		xscale = yscale = n;
		break;
	case P_X_SCALE:
		if (!MCU_stor8(data, n))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		xscale = n;
		ex = (uint2)(rect.width * xf / xscale + 0.5);
		flags |= F_SCALE_INDEPENDENTLY;
		break;
	case P_Y_SCALE:
		if (!MCU_stor8(data, n))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		yscale = n;
		ey = (uint2)(rect.height * yf / yscale + 0.5);
		flags |= F_SCALE_INDEPENDENTLY;
		break;
	case P_X_OFFSET:
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		tx = i;
		break;
	case P_Y_OFFSET:
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		ty = i;
		break;
	case P_X_EXTENT:
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		ex = i;
		resetscale();
		break;
	case P_Y_EXTENT:
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		ey = i;
		resetscale();
		break;
	case P_CURRENT_PAGE:    //set eps current page to display
		if (!MCU_stoi2(data, i))
		{
			MCeerror->add
			(EE_OBJECT_NAN, 0, 0, data);
			return ES_ERROR;
		}
		if ((uint2)i > pagecount)
			curpage = pagecount;
		else
			curpage = i;
		break;
#endif /* MCEPS::setprop */
	default:
		return MCControl::setprop_legacy(parid, p, ep, effective);
	}
	if (dirty && opened)
	{
		// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
		layer_redrawall();
	}
	return ES_NORMAL;
}