lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add Scheme function to return column associated with Item. (issue 20


From: Urs Liska
Subject: Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden)
Date: Sun, 15 Feb 2015 08:58:31 -0500
User-agent: K-9 Mail for Android

Can't judge the code but the idea looks great :-)

Urs

Am 15. Februar 2015 08:27:20 EST, schrieb address@hidden:
>Reviewers: ,
>
>Message:
>Please review.
>
>Description:
>Add Scheme function to return column associated with Item.
>
>The C++ function PaperColumn::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.
>
>Please review this at https://codereview.appspot.com/203910043/
>
>Affected files (+15, -0 lines):
>   M lily/item-scheme.cc
>
>
>Index: lily/item-scheme.cc
>diff --git a/lily/item-scheme.cc b/lily/item-scheme.cc
>index  
>0e6b71ef30a8191931495c3ff16bd6d9bb5fcadb..24ccf5bf0de97ba6666751afa514b2e777392c73
> 
>100644
>--- a/lily/item-scheme.cc
>+++ b/lily/item-scheme.cc
>@@ -19,6 +19,7 @@
>  */
>
>  #include "item.hh"
>+#include "paper-column.hh"
>
>  LY_DEFINE (ly_item_p, "ly:item?",
>             1, 0, 0, (SCM g),
>@@ -39,3 +40,17 @@ LY_DEFINE (ly_item_break_dir, "ly:item-break-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;
>+}
>
>
>
>_______________________________________________
>lilypond-devel mailing list
>address@hidden
>https://lists.gnu.org/mailman/listinfo/lilypond-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]