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.
-Clef_item::Clef_item()
+*/
+MAKE_SCHEME_CALLBACK(Clef,before_line_breaking);
+SCM
+Clef::before_line_breaking (SCM smob)
{
- change = true;
- read("violin");
+ Item * s = dynamic_cast<Item*> (unsmob_element (smob));
+
+ 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_UNSPECIFIED;
+ }
+
+ return SCM_UNSPECIFIED;
}
-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)
- t += "_change";
- Symbol s = paper()->lookup_l()->clef(t);
- Molecule*output = new Molecule(Atom(s));
- output->translate(Offset(0, paper()->internote_f() * y_off));
- return output;
-}
-IMPLEMENT_STATIC_NAME(Clef_item);