X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fbar.cc;h=913c2c72ed1c0622c0107c4ef11829ec30fef4af;hb=78ed9c22a8cbf56ff5390553e0a2854aa42cbbc5;hp=8b831d206abb23b98558f03060a860e95fa06c29;hpb=4bdf5f822b18b10b48f619c116641e6aee1968ac;p=lilypond.git diff --git a/lily/bar.cc b/lily/bar.cc index 8b831d206a..913c2c72ed 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -1,3 +1,11 @@ +/* + bar.cc -- implement Bar + + source file of the GNU LilyPond music typesetter + + (c) 1997--1999 Han-Wen Nienhuys +*/ + #include "bar.hh" #include "string.hh" #include "molecule.hh" @@ -6,23 +14,74 @@ #include "debug.hh" - -Bar::Bar( String t) +Bar::Bar () { - type = t; + set_elt_property (breakable_scm_sym, SCM_BOOL_T); + type_str_ = "|"; } void -Bar::do_print()const +Bar::do_print () const +{ +#ifndef NPRINT + String s = type_str_; + DOUT << "type = " << s; +#endif +} + +Real +Bar::get_bar_size () const { - mtor << type; + // Never called! + return 0; } + Molecule* -Bar::brew_molecule_p()const +Bar::do_brew_molecule_p () const { - Symbol s = paper()->lookup_l()->bar(type); - Molecule*output = new Molecule(Atom(s)); - return output; + Molecule *output = new Molecule (lookup_l ()->bar (type_str_, get_bar_size (), paper_l ())); + + return output; +} + +/** + Prescriptions for splitting bars. + TODO: put this in SCM. + */ +static char const *bar_breaks[][3] ={ + {":|", ":|:", "|:"}, + {"|", "|", ""}, + {"", "|s", "|"}, + {"|", "|:", "|:"}, + {"|.", "|.", ""}, + {":|", ":|", ""}, + {"||", "||", ""}, + {".|.", ".|.", ""}, + {"", "scorebar", "scorepostbreak"}, + {"", "brace", "brace"}, + {"", "bracket", "bracket"}, + {0,0,0} +}; + +void +Bar::do_pre_processing () +{ + for (int i=0; bar_breaks[i][0]; i++) + { + if (bar_breaks[i][1] == type_str_) + { + type_str_ = bar_breaks[i][break_status_dir ()+1]; + break; + } + } + if (remove_elt_property (at_line_start_scm_sym)!= SCM_BOOL_F + && (break_status_dir () == RIGHT) && (type_str_ == "")) + { + type_str_ = "|"; + } + + if (type_str_ =="") + dim_cache_[X_AXIS]->set_empty (true); } - +