Exemplo n.º 1
0
bool MCNativeControl::ParseRectangle(MCExecPoint& ep, MCRectangle& r_rect)
{
	int16_t t_left, t_top, t_right, t_bottom;
	if (!MCU_stoi2x4(ep . getsvalue(), t_left, t_top, t_right, t_bottom))
	{
		MCeerror->add(EE_OBJECT_NAR, 0, 0, ep.getsvalue());
		return false;
	}
	
	MCU_set_rect(r_rect, t_left, t_top, t_right - t_left, t_bottom - t_top);
	return true;
}
Exemplo n.º 2
0
static void MCInterfaceMarginsParse(MCExecContext& ctxt, MCStringRef p_input, MCInterfaceMargins& r_output)
{
    if (MCU_stoi2(p_input, r_output . margin))
    {
        r_output . type = kMCInterfaceMarginsTypeSingle;
        return;
    }

    if (MCU_stoi2x4(p_input, r_output . margins[0], r_output . margins[1], r_output . margins[2], r_output . margins[3]))
    {
        r_output . type = kMCInterfaceMarginsTypeQuadruple;
        return;
    }
    
    ctxt . LegacyThrow(EE_OBJECT_MARGINNAN);
}
Exemplo n.º 3
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;
}