]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/clef-item.cc
release: 1.3.69
[lilypond.git] / lily / clef-item.cc
index 626cfe64becdadeac6d4c37d55cafd251fe2df17..9c1179333d1adad3dd1d75b29fd5aff28a0dc83b 100644 (file)
@@ -3,65 +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-reg.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_){
-       empty_b_ = (break_status_i() != 1);
-       transparent_b_ = (break_status_i() != 1);
+  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))
+    {
+      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()
-{
-    default_b_ = false;
-    change_b_ = true;
-    read("violin");
+  return SCM_UNDEFINED;
 }
 
-void
-Clef_item::read(String t)
+bool
+Clef::has_interface (Score_element* me)
 {
-    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;
+  return me->has_interface (ly_symbol2scm ("clef-interface"));
 }
+
+
 void
-Clef_item::read(Clef_register const &k)
+Clef::set_interface (Score_element* me)
 {
-    read(k.clef_type_str_);
+  me->set_interface (ly_symbol2scm ("clef-interface"));
 }
 
-Molecule*
-Clef_item::brew_molecule_p()const
-{
-    String t = type_;
-    if  (change_b_)
-       t += "_change";
-    Symbol s = paper()->lookup_l()->clef(t);
-    Molecule*output = new Molecule(Atom(s));
-    output->translate_y( paper()->internote_f() * y_off);
-    return output;
-}
 
-IMPLEMENT_STATIC_NAME(Clef_item);
-IMPLEMENT_IS_TYPE_B1(Clef_item,Item);