]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-column.cc
Doc: NR - Pitches.itely - dodecaphonic-no-repeat text alt
[lilypond.git] / lily / note-column.cc
index 42bd9b484c005270e9b290b8fef74df1cd355bd9..625bed1b2f4cbc27fc507c2be414a2066cae7be9 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -156,6 +156,26 @@ Note_column::first_head (Grob *me)
   return st ? Stem::first_head (st) : 0;
 }
 
+/*
+  Return extent of the noteheads in the "main column",
+  i.e. excluding any suspended noteheads.
+*/
+Interval
+Note_column::calc_main_heads_extent (Grob *me)
+{
+  if (get_stem (me))
+    return first_head (me)->extent (me, X_AXIS);
+  else
+    {
+      // no stems => no suspended noteheads.
+      extract_grob_set (me, "note-heads", heads);
+      if (heads.size())
+        return heads[0]->extent (me, X_AXIS);
+      else
+        return Interval (0, 0);
+    }
+}
+
 /*
   Return the first AccidentalPlacement grob that we find in a note-head.
 */