Beispiel #1
0
Coord MacPrinterCanvas::height() const {
#if carbon
	return Coord(pheight());
#else
	Rect& r = (*prRecHdl)->prInfo.rPage;
	return Coord(r.bottom);
#endif
}
Beispiel #2
0
CScriptVal ICmpFootprint::GetShape_wrapper()
{
	EShape shape;
	entity_pos_t size0, size1, height;
	GetShape(shape, size0, size1, height);

	JSContext* cx = GetSimContext().GetScriptInterface().GetContext();

	JSObject* obj = JS_NewObject(cx, NULL, NULL, NULL);
	if (!obj)
		return JSVAL_VOID;

	if (shape == CIRCLE)
	{
		JS::RootedValue ptype(cx);
		JS::RootedValue pradius(cx);
		JS::RootedValue pheight(cx);
		ScriptInterface::ToJSVal<std::string>(cx, ptype.get(), "circle");
		ScriptInterface::ToJSVal(cx, pradius.get(), size0);
		ScriptInterface::ToJSVal(cx, pheight.get(), height);
		JS_SetProperty(cx, obj, "type", ptype.address());
		JS_SetProperty(cx, obj, "radius", pradius.address());
		JS_SetProperty(cx, obj, "height", pheight.address());
	}
	else
	{
		JS::RootedValue ptype(cx);
		JS::RootedValue pwidth(cx);
		JS::RootedValue pdepth(cx);
		JS::RootedValue pheight(cx);
		ScriptInterface::ToJSVal<std::string>(cx, ptype.get(), "square");
		ScriptInterface::ToJSVal(cx, pwidth.get(), size0);
		ScriptInterface::ToJSVal(cx, pdepth.get(), size1);
		ScriptInterface::ToJSVal(cx, pheight.get(), height);
		JS_SetProperty(cx, obj, "type", ptype.address());
		JS_SetProperty(cx, obj, "width", pwidth.address());
		JS_SetProperty(cx, obj, "depth", pdepth.address());
		JS_SetProperty(cx, obj, "height", pheight.address());
	}

	return OBJECT_TO_JSVAL(obj);
}