From 62baf9f46df03a7404944b78a22312d4ebca8973 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:55:47 +0000 Subject: [PATCH] lilypond-0.1.11 --- lily/lookup.cc | 56 ++++++++++++++--------------- lily/symtable.cc | 20 +++++------ lily/tex-beam.cc | 34 ++++++++++-------- lily/tex-slur.cc | 92 ++++++++++++++++++++++++------------------------ 4 files changed, 104 insertions(+), 98 deletions(-) diff --git a/lily/lookup.cc b/lily/lookup.cc index 18407dece2..480abb5f9a 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -45,13 +45,13 @@ Lookup::add (String s, Symtable*p) } void -Lookup::print()const +Lookup::print() const { - #ifndef NPRINT +#ifndef NPRINT DOUT << "Lookup: " << texsetting << " {\n"; symtables_->print(); DOUT << "}\n"; - #endif +#endif } Symbol @@ -75,7 +75,7 @@ Symbol Lookup::ball (int j) const { if (j > 2) - j = 2; + j = 2; Symtable * st = (*symtables_)("balls"); return st->lookup (String (j)); @@ -136,8 +136,8 @@ Lookup::dots (int j) const { if (j>3) { - j = 3; - warning ("max 3 dots"); // todo + j = 3; + warning ("max 3 dots"); // todo } return (*symtables_)("dots")->lookup (j); } @@ -158,13 +158,13 @@ Lookup::streepjes (int i) const if (i < 0) { - idx = "botlines"; - arg = -i; + idx = "botlines"; + arg = -i; } else { - arg = i; - idx = "toplines"; + arg = i; + idx = "toplines"; } Symbol ret = (*symtables_)("streepjes")->lookup (idx); @@ -227,9 +227,9 @@ Lookup::stem (Real y1,Real y2) const { if (y1 > y2) { - Real t = y1; - y1 = y2; - y2 = t; + Real t = y1; + y1 = y2; + y2 = t; } Symbol s; @@ -253,31 +253,31 @@ Lookup::vbrace (Real &y) const { if (y < 2* 20 PT) { - warning ( "piano brace too small (" + print_dimen (y)+ ")"); - y = 2*20 PT; + warning ("piano brace too small (" + print_dimen (y)+ ")"); + y = 2*20 PT; } if (y > 67 * 2 PT) { - warning ( "piano brace too big (" + print_dimen (y)+ ")"); - y = 67 *2 PT; + warning ("piano brace too big (" + print_dimen (y)+ ")"); + y = 67 *2 PT; } int idx = int (rint ((y/2.0 - 20) + 148)); Symbol s = (*symtables_)("param")->lookup ("brace"); { - Array a; - a.push (idx); - s.tex = substitute_args (s.tex,a); - s.dim.y() = Interval (0,y); - } + Array a; + a.push (idx); + s.tex = substitute_args (s.tex,a); + s.dim.y() = Interval (0,y); + } { - Array a; - a.push (print_dimen (y/2)); - a.push (print_dimen (0)); - a.push (s.tex); - s.tex = substitute_args ("\\placebox{%}{%}{%}", a); - } + Array a; + a.push (print_dimen (y/2)); + a.push (print_dimen (0)); + a.push (s.tex); + s.tex = substitute_args ("\\placebox{%}{%}{%}", a); + } return s; diff --git a/lily/symtable.cc b/lily/symtable.cc index 92ef19852f..25e4ff8ce7 100644 --- a/lily/symtable.cc +++ b/lily/symtable.cc @@ -23,7 +23,7 @@ Symtables::Symtables (Symtables const &s) { for (Assoc_iter i (s); i.ok(); i++) { - add (i.key(), new Symtable (*i.val ())); + add (i.key(), new Symtable (*i.val ())); } } @@ -31,7 +31,7 @@ Symtables::~Symtables() { for (Assoc_iter i (*this); i.ok(); i++) { - delete i.val(); + delete i.val(); } } @@ -39,12 +39,12 @@ Symbol Symtable::lookup (String s) const { if (elt_b (s)) - return (*this)[s]; + return (*this)[s]; else { - warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n"); - Symbol sy; - return sy; + warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n"); + Symbol sy; + return sy; } } @@ -58,9 +58,9 @@ Symtables::print() const { for (Assoc_iter i (*this); i.ok(); i++) { - DOUT << "table \'" << i.key() << "\' {\n"; - i.val()->print (); - DOUT << "}\n"; + DOUT << "table \'" << i.key() << "\' {\n"; + i.val()->print (); + DOUT << "}\n"; } } void @@ -68,7 +68,7 @@ Symtable::print() const { for (Assoc_iter i (*this); i.ok(); i++) { - DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n"; + DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n"; } } diff --git a/lily/tex-beam.cc b/lily/tex-beam.cc index f20ded05e4..c16a0e9c02 100644 --- a/lily/tex-beam.cc +++ b/lily/tex-beam.cc @@ -1,7 +1,13 @@ /* + tex-beam.cc -- implement Lookup::{beam_element, beam, rule_symbol} + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys +*/ + +/* Code to generate beams for TeX - */ #include @@ -35,17 +41,17 @@ slope_index (Real &s) { if (abs (s) > 0.5) { - WARN << "beam steeper than 0.5 (" << s << ")\n"; - s = sign (s) * 0.5; + WARN << "beam steeper than 0.5 (" << s << ")\n"; + s = sign (s) * 0.5; } int i = int (rint (s * 20.0)); s = i/20.0; if (s>0) - return 6*i +122; + return 6*i +122; else - return -6 * i+ 186; + return -6 * i+ 186; } Symbol @@ -66,11 +72,11 @@ Lookup::beam (Real &slope, Real width) const { int sidx = slope_index (slope); if (!slope) - return rule_symbol (2 PT, width); + return rule_symbol (2 PT, width); if (width < 2 PT) { - WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n"; - width = 2 PT; + WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n"; + width = 2 PT; } Real elemwidth = 64 PT; int widx = 5; @@ -79,8 +85,8 @@ Lookup::beam (Real &slope, Real width) const while (elemwidth > width) { - widx --; - elemwidth /= 2.0; + widx --; + elemwidth /= 2.0; } Real overlap = elemwidth/4; Real last_x = width - elemwidth; @@ -90,10 +96,10 @@ Lookup::beam (Real &slope, Real width) const m.add (a); while (x < last_x) { - a=elem; - a.translate (Offset (x-overlap, (x-overlap)*slope)); - m.add (a); - x += elemwidth - overlap; + a=elem; + a.translate (Offset (x-overlap, (x-overlap)*slope)); + m.add (a); + x += elemwidth - overlap; } a=elem; a.translate (Offset (last_x, (last_x) * slope)); diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index b494ec5c1a..3463d38494 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -22,17 +22,17 @@ char direction_char (int y_sign) char c='#'; switch (y_sign) { - case -1: - c = 'd'; - break; - case 0: - c = 'h'; - break; - case 1: - c = 'u'; - break; - default: - assert (false); + case -1: + c = 'd'; + break; + case 0: + c = 'h'; + break; + case 1: + c = 'u'; + break; + default: + assert (false); } return c; } @@ -41,15 +41,15 @@ Symbol Lookup::half_slur_middlepart (Real &dx, int dir) const { if (dx >= 400 PT) {// todo - WARN<<"halfslur too large" <= 96 PT) { - WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n"; - dx = 96 PT; + WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n"; + dx = 96 PT; } widx = int (rint (dx/12.0)); dx = widx*12.0; if (widx) - widx --; + widx --; else { - WARN << "slur too narrow " << print_dimen (orig_dx)<<"\n"; + WARN << "slur too narrow " << print_dimen (orig_dx)<<"\n"; } Symbol s; @@ -109,16 +109,16 @@ Lookup::half_slur (int dy, Real &dx, int dir, int xpart) const int hidx = dy; if (hidx <0) - hidx = -hidx; + hidx = -hidx; hidx --; int idx =-1; idx = widx * 16 + hidx; if (xpart < 0) - idx += 128; + idx += 128; assert (idx < 256); - f+=String ("{") + String (idx ) + "}"; + f+=String ("{") + String (idx) + "}"; s.tex = f; @@ -136,32 +136,32 @@ Lookup::slur (int dy , Real &dx, int dir) const if (y_sign) { - large |= dx>= 4*16 PT; + large |= dx>= 4*16 PT; } else - large |= dx>= 4*54 PT; + large |= dx>= 4*54 PT; if (large) { - return big_slur (dy, dx, dir); + return big_slur (dy, dx, dir); } Real orig_dx = dx; int widx = int (floor (dx/4.0)); // slurs better too small.. dx = 4.0 * widx; if (widx) - widx --; + widx --; else { - WARN << "slur too narrow: " << print_dimen (orig_dx) << "\n"; + WARN << "slur too narrow: " << print_dimen (orig_dx) << "\n"; } int hidx = dy; if (hidx <0) - hidx = -hidx; + hidx = -hidx; hidx --; if (hidx > 8) { - WARN<<"slur to steep: " << dy << " shrinking (ugh)\n"; + WARN<<"slur to steep: " << dy << " shrinking (ugh)\n"; } Symbol s; @@ -172,25 +172,25 @@ Lookup::slur (int dy , Real &dx, int dir) const int idx=-1; if (y_sign) { - idx = hidx * 16 + widx; - if (dir < 0) - idx += 128; - } + idx = hidx * 16 + widx; + if (dir < 0) + idx += 128; + } else { - if (dx >= 4*54 PT) - { - WARN << "slur too wide: " << print_dimen (dx) << - " shrinking (ugh)\n"; - dx = 4*54 PT; - } - idx = widx; - if (dir < 0) - idx += 54; + if (dx >= 4*54 PT) + { + WARN << "slur too wide: " << print_dimen (dx) << + " shrinking (ugh)\n"; + dx = 4*54 PT; + } + idx = widx; + if (dir < 0) + idx += 54; } assert (idx < 256); - f+=String ("{") + String (idx ) + "}"; + f+=String ("{") + String (idx) + "}"; s.tex = f; Atom a (s); -- 2.39.5