Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "grob.hh"
-
-#include "warn.hh"
+#include "warn.hh" // error()
#include "item.hh"
#include "output-def.hh"
#include "system.hh"
#include "font-interface.hh"
#include "paper-score.hh"
-
+#include "grob-array.hh"
LY_DEFINE (ly_grob_property_data, "ly:grob-property-data",
2, 0, 0, (SCM grob, SCM sym),
- //, SCM dfault),
"Retrieve @var{sym} for @var{grob} but don't process callbacks.")
{
Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
- // SCM_ASSERT_TYPE (ly_is_procedure (proc), proc, SCM_ARG3, __FUNCTION__, "procedure");
return sc->get_property_data (sym);
}
&& !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
error ("typecheck failed");
- sc->internal_set_property (sym, val);
+ sc->set_property (sym, val);
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_grob_interfaces, "ly:grob-interfaces",
1, 0, 0, (SCM grob),
- "Return the interfaces list of grob @var{grob}.")
+ "Return the interfaces list of grob @var{grob}.")
{
Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
return ly_interval2scm (sc->extent (ref, a));
}
+LY_DEFINE (ly_grob_robust_relative_extent, "ly:grob-robust-relative-extent",
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
+ "Get the extent in @var{axis} direction of @var{grob} relative to "
+ "the grob @var{refp}, or (0,0) if empty")
+{
+ Grob *sc = unsmob_grob (grob);
+ Grob *ref = unsmob_grob (refp);
+
+ SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+ SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
+ SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+ Axis a = Axis (scm_to_int (axis));
+
+ if (ref->common_refpoint (sc, a) != ref)
+ {
+ // ugh. should use other error message
+ SCM_ASSERT_TYPE (false, refp, SCM_ARG2, __FUNCTION__, "common refpoint");
+ }
+
+ return ly_interval2scm (robust_relative_extent (sc, ref, a));
+}
LY_DEFINE (ly_grob_relative_coordinate, "ly:grob-relative-coordinate",
3, 0, 0, (SCM grob, SCM refp, SCM axis),
return Font_interface::get_default_font (gr)->self_scm ();
}
+
+/*
+ TODO: consider swapping order, so we can do
+
+ (grob-common-refpoint a b c d e)
+ */
LY_DEFINE (ly_grob_common_refpoint, "ly:grob-common-refpoint",
3, 0, 0, (SCM grob, SCM other, SCM axis),
"Find the common refpoint of @var{grob} and @var{other} for @var{axis}."