X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fclef-item.cc;h=d7c323ee609b38d463ecbc5e6de38aa6394c2eee;hb=0c1ce854cfb2b9ad594526e359ec206fdd9b21fe;hp=a63d8b72bd5d910910b6a56c1c34f0519d3d6f83;hpb=6a1295eaacbc3e6b5a7ce19f7f942b23f8d7f2ff;p=lilypond.git diff --git a/lily/clef-item.cc b/lily/clef-item.cc index a63d8b72bd..d7c323ee60 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -3,77 +3,73 @@ source file of the GNU LilyPond music typesetter - (c) 1997 Han-Wen Nienhuys + (c) 1997--2001 Han-Wen Nienhuys */ -#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" +#include "font-interface.hh" -void -Clef_item::do_pre_processing() +/* + FIXME: should use symbol for #'style. +*/ +MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1); +SCM +Clef::before_line_breaking (SCM smob) { - change_b_ = ! (break_status_i() == 1); + Item * s = dynamic_cast (unsmob_grob (smob)); - if (default_b_) + SCM glyph = s->get_grob_property ("glyph-name"); + + if (gh_string_p (glyph)) { - set_empty(break_status_i() != 1); - transparent_b_ = (break_status_i() != 1); + String str = ly_scm2string (glyph); + + if (to_boolean (s->get_grob_property ("non-default")) + && s->break_status_dir () != RIGHT + && !to_boolean (s->get_grob_property ("full-size-change"))) + { + str += "_change"; + s->set_grob_property ("glyph-name", 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 (Grob* 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) +Clef::set_interface (Grob* me) { - read (k.clef_type_str_); + me->set_interface (ly_symbol2scm ("clef-interface")); } -Molecule* -Clef_item::brew_molecule_p() const +MAKE_SCHEME_CALLBACK (Clef,brew_molecule,1) +SCM +Clef::brew_molecule (SCM smob) { - 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; + Grob * sc = unsmob_grob (smob); + SCM glyph = sc->get_grob_property ("glyph-name"); + if (gh_string_p (glyph)) + { + return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).smobbed_copy (); + } + else + { + return SCM_EOL; + } } - - -IMPLEMENT_IS_TYPE_B1(Clef_item,Item);