]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob-scheme.cc
* mf/GNUmakefile: always trace pfa fonts.
[lilypond.git] / lily / grob-scheme.cc
index 6e36de07d4aa9c901f430a892cc60c5a641d172a..70004e9959290f43cfe065c1b9a7ceb1402f7de7 100644 (file)
@@ -23,28 +23,27 @@ LY_DEFINE (ly_set_grob_property,"ly:set-grob-property!", 3, 0, 0,
 
 LY_DEFINE (ly_get_grob_property,
          "ly:get-grob-property", 2, 0, 0, (SCM grob, SCM sym),
-         "Get the value of a value in grob @var{g} of property @var{sym}. It
-will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.
-
-Grob properties are stored as GUILE association lists, with symbols as
-keys. All lookup functions identify undefined properties with
-end-of-list (i.e. @code{'()} in Scheme or @code{SCM_EOL} in C)
-
-Properties are stored in two ways:
-@itemize @bullet
-@item mutable properties.
-Grob properties that change from object to object. The storage of
-these are private to a grob. For example pointers to other grobs are
-always stored in the mutable properties.
-
-@item immutable properties.
-Grob properties that are shared across different grobs of the same
-type. The storage is shared, and hence it is read-only. Typically, this
-is used to store function callbacks, and default settings. They are
-initially read from @file{scm/grob-description.scm}.
-@end itemize
-
-")
+         "Get the value of a value in grob @var{g} of property @var{sym}. It\n"
+"will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.\n"
+"\n"
+"Grob properties are stored as GUILE association lists, with symbols as\n"
+"keys. All lookup functions identify undefined properties with\n"
+"end-of-list (i.e. @code{'()} in Scheme or @code{SCM_EOL} in C)\n"
+"\n"
+"Properties are stored in two ways:\n"
+"@itemize @bullet\n"
+"@item mutable properties.\n"
+"Grob properties that change from object to object. The storage of\n"
+"these are private to a grob. For example pointers to other grobs are\n"
+"always stored in the mutable properties.\n"
+"\n"
+"@item immutable properties.\n"
+"Grob properties that are shared across different grobs of the same\n"
+"type. The storage is shared, and hence it is read-only. Typically, this\n"
+"is used to store function callbacks, and default settings. They are\n"
+"initially read from @file{scm/grob-description.scm}.\n"
+"@end itemize\n"
+"\n")
 {
   Grob * sc = unsmob_grob (grob);
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
@@ -60,7 +59,7 @@ LY_DEFINE (spanner_get_bound, "ly:get-spanner-bound", 2 , 0, 0,
 {
   Spanner * sl = dynamic_cast<Spanner*> (unsmob_grob (slur));
   SCM_ASSERT_TYPE (sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
-  SCM_ASSERT_TYPE (ly_dir_p (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
+  SCM_ASSERT_TYPE (is_direction (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
   return sl->get_bound (to_dir (dir))->self_scm ();
 }
 
@@ -77,6 +76,19 @@ LY_DEFINE (ly_get_paper_var,"ly:get-paper-variable", 2, 0, 0,
   return sc->get_paper () ->lookup_variable (sym);
 }
 
+/* TODO: make difference between scaled and unscalead variable in
+   calling (i.e different funcs.) */
+LY_DEFINE (ly_grob_paper,"ly:grob-paper", 1, 0, 0,
+  (SCM grob),
+  "Get \\paper definition from a grob.")
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+  return sc->get_paper ()->self_scm ();
+}
+
+
 
 
 LY_DEFINE (ly_get_extent, "ly:get-extent", 3, 0, 0,
@@ -89,7 +101,7 @@ LY_DEFINE (ly_get_extent, "ly:get-extent", 3, 0, 0,
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
   SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
   
-  SCM_ASSERT_TYPE (ly_axis_p (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
 
   return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
 }
@@ -100,14 +112,13 @@ LY_DEFINE (ly_get_parent, "ly:get-parent", 2, 0, 0, (SCM grob, SCM axis),
 {
   Grob * sc = unsmob_grob (grob);
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE (ly_axis_p (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
 
   Grob * par = sc->get_parent (Axis (gh_scm2int (axis)));
   return par ? par->self_scm () : SCM_EOL;
 }
 
-/* ly prefix? */
-LY_DEFINE (get_system,
+LY_DEFINE (ly_get_system,
           "ly:get-system",
           1, 0, 0, (SCM grob),
           "Return the System Grob of @var{grob}.")
@@ -121,8 +132,7 @@ LY_DEFINE (get_system,
   return SCM_EOL;
 }
 
-/* ly prefix? */
-LY_DEFINE (get_original,
+LY_DEFINE (ly_get_original,
           "ly:get-original",
           1, 0, 0, (SCM grob),
           "Return the original Grob of @var{grob}")
@@ -151,3 +161,32 @@ LY_DEFINE (get_broken_into,
   return s;
 }
 
+
+LY_DEFINE (ly_grob_suicide,
+         "ly:grob-suicide", 1, 0, 0, (SCM g),
+          "Kill @var{g}.")
+{
+  Grob *me = unsmob_grob (g);
+  SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
+
+  me->suicide ();
+  return SCM_UNDEFINED;
+}
+
+
+
+LY_DEFINE (ly_grob_translate_axis_x,
+         "ly:grob-translate-axis!", 3, 0, 0,
+          (SCM g, SCM d, SCM a),
+          "Translate @var{g} on axis @var{a} over distance @var{d}.")
+{
+  Grob *me = unsmob_grob (g);
+  SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (gh_number_p (d), d, SCM_ARG2, __FUNCTION__, "dimension");
+  SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis");
+
+  me->translate_axis (gh_scm2double (d),
+                     Axis (gh_scm2int (a)));
+  return SCM_UNDEFINED;
+}
+