]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-item.cc
release: 1.3.61
[lilypond.git] / lily / text-item.cc
index 35e5aa5c3dfca2e8242ea7c5f6d14183118374e2..ae3ea80b402c916e98cd0454450627f08533a833 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-  text-item.cc -- implement Text_item
+  text-item.cc -- implement Item
 
   source file of the GNU LilyPond music typesetter
   
@@ -7,40 +7,41 @@
   
  */
 
-#include "text-item.hh"
 #include "debug.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
 
-Text_item::Text_item (SCM s)
-  : Item (s)
+struct Text_item
 {
-  
-}
+  static SCM scheme_molecule (SCM);
+};
 
-MAKE_SCHEME_SCORE_ELEMENT_CALLBACKS(Text_item)
 
-Molecule 
-Text_item::do_brew_molecule () const
+MAKE_SCHEME_SCORE_ELEMENT_NON_DEFAULT_CALLBACKS(Text_item)
+
+SCM 
+Text_item::scheme_molecule (SCM sm) 
 {
-  SCM style = get_elt_property ("style");
+  Score_element * s = unsmob_element (sm);
+  
+  SCM style = s->get_elt_property ("style");
   String st = gh_string_p (style) ?  ly_scm2string (style) : "";
-  SCM txt = get_elt_property ("text");
+  SCM txt = s-> get_elt_property ("text");
   String t = gh_string_p (txt) ? ly_scm2string (txt) : "";
 
-  Molecule mol = paper_l ()->lookup_l(0)->text (st, t, paper_l ());
+  Molecule mol =  s->paper_l ()->lookup_l(0)->text (st, t, s->paper_l ());
 
-  SCM s = get_elt_property ("word-space");
-  if (gh_number_p (s))
+  SCM space =  s->get_elt_property ("word-space");
+  if (gh_number_p (space))
     {
       Molecule m;
       m.set_empty (false);
-      mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (s)*
-                      staff_symbol_referencer (this).staff_space ());
+      mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
+                      staff_symbol_referencer  (s).staff_space ());
     }
-  return mol; 
+  return mol.create_scheme ()
 }