]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.11
authorfred <fred>
Sun, 24 Mar 2002 19:55:47 +0000 (19:55 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:55:47 +0000 (19:55 +0000)
lily/lookup.cc
lily/symtable.cc
lily/tex-beam.cc
lily/tex-slur.cc

index 18407dece2e63f86c6d32713d720a77e9d682ebc..480abb5f9a06212c7f62abbccfaf2f2360ce2794 100644 (file)
@@ -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<String> a;
-       a.push (idx);
-       s.tex = substitute_args (s.tex,a);
-       s.dim.y() = Interval (0,y);
-    }
+    Array<String> a;
+    a.push (idx);
+    s.tex = substitute_args (s.tex,a);
+    s.dim.y() = Interval (0,y);
+  }
   {
-       Array<String> a;
-       a.push (print_dimen (y/2));
-       a.push (print_dimen (0));
-       a.push (s.tex);
-       s.tex = substitute_args ("\\placebox{%}{%}{%}", a);
-    }
+    Array<String> a;
+    a.push (print_dimen (y/2));
+    a.push (print_dimen (0));
+    a.push (s.tex);
+    s.tex = substitute_args ("\\placebox{%}{%}{%}", a);
+  }
 
        
   return s;
index 92ef19852f66496c41bc5f7ede37991dfbe5cb98..25e4ff8ce735eaf19ab5ee48d928d8947fe89c94 100644 (file)
@@ -23,7 +23,7 @@ Symtables::Symtables (Symtables const &s)
 {
   for (Assoc_iter<String, Symtable*>  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<String, Symtable*>  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<String, Symtable*>  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<String, Symbol>  i (*this); i.ok(); i++) 
     {
-       DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
+      DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
     }
 }
        
index f20ded05e4c4b27fe30fd781c2d0001cc488a499..c16a0e9c02a722e0b65da52327b4072a75926be1 100644 (file)
@@ -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 <hanwen@stack.nl>
+*/
+
+/*
   Code to generate beams for TeX
-  
   */
 
 #include <math.h>
@@ -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));
index b494ec5c1a813601b20f34cfe149da86723b30ae..3463d38494eb53dc3b6dd1236342513de5a05e62 100644 (file)
@@ -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" <<print_dimen (dx)<< "shrinking (ugh)\n";
-       dx = 400 PT;
-    }
+    WARN<<"halfslur too large" <<print_dimen (dx)<< "shrinking (ugh)\n";
+    dx = 400 PT;
+  }
   int widx = int (floor (dx / 4.0));
   dx = widx * 4.0;
   if (widx) widx --;
   else 
     {
-       WARN <<  "slur too narrow\n";
+      WARN <<  "slur too narrow\n";
     }
 
   Symbol s;
@@ -62,11 +62,11 @@ Lookup::half_slur_middlepart (Real &dx, int dir) const
 
   int idx = widx;
   if (dir < 0)
-       idx += 128;
+    idx += 128;
 
   assert (idx < 256);
 
-  f+=String ("{") + String (idx ) + "}";
+  f+=String ("{") + String (idx) + "}";
   s.tex = f;
   Atom a (s);
   a.translate (dx/2, X_AXIS);
@@ -79,23 +79,23 @@ Lookup::half_slur (int dy, Real &dx, int dir, int xpart) const
 {
   Real orig_dx = dx;
   if (!xpart)
-       return half_slur_middlepart (dx, dir);
+    return half_slur_middlepart (dx, dir);
 
   int widx;
                
   if (dx >= 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);