summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
60eeb4a)
The C++ function Paper_column::get_column is used frequently,
and it makes sense to have a Scheme function which performs
the same task. An example of a practical application
is the request by users to return the location of a particular
grob in a score: this is done by examining the PaperColumn
or NonMusicalPaperColumn associated with the grob.
+#include "paper-column.hh"
LY_DEFINE (ly_item_p, "ly:item?",
1, 0, 0, (SCM g),
LY_DEFINE (ly_item_p, "ly:item?",
1, 0, 0, (SCM g),
Item *me = Item::unsmob (it);
return scm_from_int (me->break_status_dir ());
}
Item *me = Item::unsmob (it);
return scm_from_int (me->break_status_dir ());
}
+
+LY_DEFINE (ly_item_get_column, "ly:item-get-column",
+ 1, 0, 0, (SCM it),
+ "Return the @code{PaperColumn} or @code{NonMusicalPaperColumn}"
+ " associated with this @code{Item}.")
+{
+ LY_ASSERT_SMOB (Item, it, 1);
+ Item *me = Item::unsmob (it);
+
+ if (Paper_column *col = me->get_column ())
+ return col->self_scm ();
+
+ return SCM_EOL;
+}