]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/clef-item.cc
release: 1.3.69
[lilypond.git] / lily / clef-item.cc
index 8a2534b111782dab90037a25b793821db102c259..9c1179333d1adad3dd1d75b29fd5aff28a0dc83b 100644 (file)
@@ -3,67 +3,66 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "clef-item.hh"
+
+#include "clef.hh"
 #include "string.hh"
 #include "molecule.hh"
-#include "paper-def.hh"
-#include "lookup.hh"
-#include "clef-grav.hh"
+#include "item.hh"
 
+/*
+FIXME: should use symbol.
 
-void
-Clef_item::do_pre_processing()
+*/
+MAKE_SCHEME_CALLBACK(Clef,before_line_breaking);
+SCM
+Clef::before_line_breaking (SCM smob)
 {
-  change_b_ = ! (break_status_i() == 1);
+  Item * s = dynamic_cast<Item*> (unsmob_element (smob));
 
-  if (default_b_)
+  SCM style_sym =s->get_elt_property ("style");
+  String style;
+  if (gh_string_p (style_sym))
+    style = ly_scm2string (style_sym);
+
+  SCM glyph = s->get_elt_property ("glyph");
+  
+  if (gh_string_p (glyph))
     {
-       empty_b_ = (break_status_i() != 1);
-       transparent_b_ = (break_status_i() != 1);
+      String str = ly_scm2string (glyph);
+
+      /*
+       FIXME: should use fontsize property to set clef changes.
+       */
+      if (s->get_elt_property ("non-default") &&
+         s->break_status_dir() != RIGHT && style != "fullSizeChanges")
+       {
+         str += "_change";
+         s->set_elt_property ("glyph", ly_str02scm (str.ch_C()));        
+       }
+    }
+  else
+    {
+      s->suicide ();
+      return SCM_UNDEFINED;
     }
-}
 
-Clef_item::Clef_item()
-{
-  breakable_b_ =true;
-  default_b_ = false;
-  change_b_ = true;
-  read ("violin");
+  return SCM_UNDEFINED;
 }
 
-void
-Clef_item::read (String t)
-{
-  type_= t;
-  if (type_ == "violin")
-       y_off = 2;
-  if (type_ == "alto")
-       y_off = 4;
-  if (type_ == "tenor")
-       y_off = 6;
-  if (type_ == "bass")
-       y_off = 6;
-}
-void
-Clef_item::read (Clef_engraver const &k)
+bool
+Clef::has_interface (Score_element* me)
 {
-  read (k.clef_type_str_);
+  return me->has_interface (ly_symbol2scm ("clef-interface"));
 }
 
-Molecule*
-Clef_item::brew_molecule_p()const
+
+void
+Clef::set_interface (Score_element* me)
 {
-  String t = type_;
-  if  (change_b_)
-       t += "_change";
-  Symbol s = paper()->lookup_l ()->clef (t);
-  Molecule*output = new Molecule (Atom (s));
-  output->translate (paper()->internote_f () * y_off, Y_AXIS);
-  return output;
+  me->set_interface (ly_symbol2scm ("clef-interface"));
 }
 
 
-IMPLEMENT_IS_TYPE_B1(Clef_item,Item);