]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/clef-item.cc
release: 1.3.69
[lilypond.git] / lily / clef-item.cc
index d860b494f2c9f2836b691adb079eb2abb8350ef6..9c1179333d1adad3dd1d75b29fd5aff28a0dc83b 100644 (file)
@@ -3,78 +3,66 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include <ctype.h>
-#include "clef-item.hh"
+
+#include "clef.hh"
 #include "string.hh"
 #include "molecule.hh"
-#include "paper-def.hh"
-#include "lookup.hh"
-#include "clef-engraver.hh"
-#include "text-item.hh"
+#include "item.hh"
 
-void
-Clef_item::do_pre_processing()
+/*
+FIXME: should use symbol.
+
+*/
+MAKE_SCHEME_CALLBACK(Clef,before_line_breaking);
+SCM
+Clef::before_line_breaking (SCM smob)
 {
-  bool b= (break_status_dir() != RIGHT);
-  change_b_ = b;
+  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))
     {
-      set_empty(b);
-      transparent_b_ = b;
+      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;
+    }
+
+  return SCM_UNDEFINED;
 }
 
-/*
-  FIXME
-*/
-Clef_item::Clef_item()
+bool
+Clef::has_interface (Score_element* me)
 {
-  breakable_b_ =true;
-  default_b_ = false;
-  change_b_ = true;
-  octave_dir_ = CENTER;
-  symbol_ = "treble";
-  y_position_i_ = -2;
-  
-  // Ugh: This should be const, I guess.
-  octave_marker_td_p_.set_p (new Text_def());// UGH!
-  octave_marker_td_p_->text_str_ = "8";
-  octave_marker_td_p_->style_str_ = "italic";
+  return me->has_interface (ly_symbol2scm ("clef-interface"));
 }
 
 
-
-
-Molecule*
-Clef_item::brew_molecule_p() const
+void
+Clef::set_interface (Score_element* me)
 {
-  String t = symbol_;
-  if  (change_b_)
-    t += "_change";
-  Atom s = lookup_l ()->clef (t);
-  Molecule*output = new Molecule (Atom (s));
-  output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
-  if (octave_dir_) {
-    Molecule octave_marker = Molecule(octave_marker_td_p_->get_atom(paper(),
-                                                               CENTER));
-    Real offset = output->extent()[Y_AXIS][octave_dir_]
-                  - octave_marker.extent()[Y_AXIS][- octave_dir_];
-    if (octave_dir_ == DOWN)
-      offset += octave_marker.extent()[Y_AXIS][UP] * 0.35 ;
-    octave_marker.translate_axis (offset, Y_AXIS);
-    output->add_molecule (octave_marker);
-  }
-  return output;
+  me->set_interface (ly_symbol2scm ("clef-interface"));
 }
 
 
-
-
-#include "pointer.tcc"
-template class P<Text_def>;    // ugh
-
-