X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbar.cc;h=cfbecaa64551ebcf169542d0fe75aa07a2118dfe;hb=bb36bac02a64770871780231ecc709cb18b20932;hp=7dc97c7c59787885016533994bb7d5f4c079f8bd;hpb=13e79c0250d34b6bdfbafbc551ef64e8b59b2991;p=lilypond.git diff --git a/lily/bar.cc b/lily/bar.cc index 7dc97c7c59..cfbecaa645 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -3,9 +3,10 @@ source file of the GNU LilyPond music typesetter - (c) 1997 Han-Wen Nienhuys + (c) 1997--2000 Han-Wen Nienhuys */ +#include "dimension-cache.hh" #include "bar.hh" #include "string.hh" #include "molecule.hh" @@ -13,60 +14,66 @@ #include "lookup.hh" #include "debug.hh" -Bar::Bar() + +Bar::Bar () { - breakable_b_ = true; - type_str_ = "|"; - spanned_i_ = 0; + set_elt_property ("breakable", SCM_BOOL_T); } - -IMPLEMENT_IS_TYPE_B1(Bar,Item); - -void -Bar::do_print()const +Real +Bar::get_bar_size () const { - DOUT << type_str_; + // Never called! + return 0; } + Molecule* -Bar::brew_molecule_p()const -{ - Paper_def *p = paper(); - Symbol s = p->lookup_l()->bar (type_str_, - p->get_var ("bar_size")); - Molecule*output = new Molecule (Atom (s)); +Bar::do_brew_molecule_p () const +{ + String s = ly_scm2string (get_elt_property ("glyph")); + Molecule *output + = new Molecule (lookup_l ()->bar (s, get_bar_size (), paper_l ())); + return output; } -/** - Prescriptions for splitting bars. - TODO: parametrise this (input-settable) - */ -static char const *bar_breaks[][3] ={ - {":|", ":|:", "|:"}, - {"|", "|", ""}, - {"", "|:", "|:"}, - {"||.", "||.", ""}, - {":|", ":|", ""}, - {0,0,0} -}; + void -Bar::do_pre_processing() +Bar::do_pre_processing () { - for (int i=0; bar_breaks[i][0]; i++) + SCM g = get_elt_property ("glyph"); + SCM breakdir = gh_int2scm (break_status_dir ()); + + if (gh_string_p (g)) + { + g = scm_eval (gh_list (ly_symbol2scm ("break-barline"), + g, + breakdir, + SCM_UNDEFINED)); + } + else { - if (bar_breaks[i][1] == type_str_) - type_str_ = bar_breaks[i][break_status_i()+1]; + g = SCM_UNDEFINED; } - /* - span_score_bar needs dims, so don't do +#if 0 + if (remove_elt_property ("at-line-start") == SCM_BOOL_T // UGR. + && (break_status_dir () == RIGHT) && (type_str_ == "")) + { + type_str_ = "|"; + } +#endif - transparent_b_ = empty_b_ = (type_str_ == ""); - - */ + if (!gh_string_p (g)) + { + set_elt_property ("transparent", SCM_BOOL_T); + set_empty (X_AXIS); + } + else + set_elt_property ("glyph", g); } +