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))
{
- set_empty(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_UNSPECIFIED;
}
-}
-Clef_item::Clef_item()
-{
- breakable_b_ =true;
- default_b_ = false;
- change_b_ = true;
- read ("violin");
+ return SCM_UNSPECIFIED;
}
-void
-Clef_item::read (String t)
+bool
+Clef::has_interface (Score_element* me)
{
- symbol_= t;
- if (t == "violin") {
- y_position_i_ = -2;
- }
- else if (t == "soprano") {
- symbol_="alto";
- y_position_i_ = -4;
- }
- else if (t == "alto") {
- y_position_i_ = 0;
- }
- else if (t == "tenor") {
- symbol_="alto";
- y_position_i_ = 2;
- }
- else if (t == "bass") {
- y_position_i_ = 2;
- }
+ return me->has_interface (ly_symbol2scm ("clef-interface"));
}
-void
-Clef_item::read (Clef_engraver const &k)
-{
- read (k.clef_type_str_);
-}
-Molecule*
-Clef_item::brew_molecule_p() const
+void
+Clef::set_interface (Score_element* me)
{
- String t = symbol_;
- if (change_b_)
- t += "_change";
- Atom s = paper()->lookup_l ()->clef (t);
- Molecule*output = new Molecule (Atom (s));
- output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
- return output;
+ me->set_interface (ly_symbol2scm ("clef-interface"));
}
-IMPLEMENT_IS_TYPE_B1(Clef_item,Item);