]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.22
authorfred <fred>
Sun, 24 Mar 2002 20:00:14 +0000 (20:00 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:00:14 +0000 (20:00 +0000)
18 files changed:
lily/Stable.make
lily/abbreviation-beam.cc
lily/bar.cc
lily/beam.cc
lily/clef-item.cc
lily/include/atom.hh
lily/include/graphical-element.hh
lily/include/molecule.hh
lily/local-key-item.cc
lily/lookup.cc
lily/lyric-grav.cc
lily/meter.cc
lily/rest.cc
lily/script.cc
lily/span-bar.cc
lily/tex-slur.cc
lily/text-item.cc
lily/vertical-align-elem.cc

index 9214c7fb0b9013ef444c1ebfa804c96a4a5051b6..6aebc2b0a511304e50ce841b85d8ef87c1e2233e 100644 (file)
@@ -1,7 +1,7 @@
 
 
 # a hack to keep exec size under control.
-stablecc=  offset.cc meter.cc boxes.cc \
+stablecc=meter.cc boxes.cc \
        keyword.cc leastsquares.cc \
        lookup.cc meter.cc\
        parser.cc notename-table.cc lexer.cc\
index 309337dffb893dd7795fbae9a84cb367e72a73a6..ac36ae99d026d8caae9e17f6632475a5e7cebed4 100644 (file)
@@ -54,7 +54,7 @@ Abbreviation_beam::brew_molecule_p () const
       sb.translate (Offset (x, (x * slope  + left_pos)* inter_f));
       mol_p->add (sb);
     }
-  mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
+  mol_p->translate_axis (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
   return mol_p;
 #endif
 }
index 05a855714861d389d68f24b6ad50eff4f3e5f31a..8fb57283149262ae25f7aa659d971c612371e91e 100644 (file)
@@ -35,7 +35,9 @@ Bar::brew_molecule_p() const
 {    
   Paper_def *p = paper();
   Atom s = p->lookup_l()->bar (type_str_, 
-                                p->get_var ("bar_size"));
+                              p->get_var ("bar_size"));
+   s.translate_axis (-s.extent()[Y_AXIS].center (), Y_AXIS);
+  
   Molecule*output = new Molecule (Atom (s));
   return output;
 }
index d2b5e1e3c620a3d07a7460be9b052f0433c8a50b..b1dae43061988fcd80c9b5e6f295c327356e2008 100644 (file)
@@ -71,7 +71,7 @@ Beam::brew_molecule_p() const
       sb.translate (Offset (x, (x * slope  + left_pos)* inter_f));
       mol_p->add (sb);
     }
-  mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
+  mol_p->translate_axis (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
   return mol_p;
 }
 
@@ -311,7 +311,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
       for (int j = 0; j  < lhalfs; j++) 
        {
          Atom b (a);
-         b.translate (-dir_ * dy * (lwholebeams+j), Y_AXIS);
+         b.translate_axis (-dir_ * dy * (lwholebeams+j), Y_AXIS);
          leftbeams.add (b);
        }
     }
@@ -332,7 +332,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
          for (; j  < nogap; j++) 
            {
              Atom b (a);
-             b.translate (-dir_ * dy * j, Y_AXIS);
+             b.translate_axis (-dir_ * dy * j, Y_AXIS);
              rightbeams.add (b); 
            }
          // TODO: notehead widths differ for different types
@@ -355,7 +355,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
       for (; j  < rwholebeams + rhalfs; j++) 
        {
          Atom b (a);
-         b.translate (-dir_ * dy * j, Y_AXIS);
+         b.translate_axis (-dir_ * dy * j, Y_AXIS);
          rightbeams.add (b); 
        }
        
index a0ca99bcc5b90d9fc987da43cf2435b2be25558c..d6c02e542cfda9d0c369eb821dd8017fc9a9eb5b 100644 (file)
@@ -39,13 +39,13 @@ Clef_item::read (String t)
 {
   type_= t;
   if (type_ == "violin")
-    y_off = 2;
+    y_position_i_ = -2;
   if (type_ == "alto")
-    y_off = 4;
+    y_position_i_ = 0;
   if (type_ == "tenor")
-    y_off = 6;
+    y_position_i_ = 2;
   if (type_ == "bass")
-    y_off = 6;
+    y_position_i_ = 2;
 }
 void
 Clef_item::read (Clef_engraver const &k)
@@ -61,7 +61,7 @@ Clef_item::brew_molecule_p() const
     t += "_change";
   Atom s = paper()->lookup_l ()->clef (t);
   Molecule*output = new Molecule (Atom (s));
-  output->translate (paper()->internote_f () * y_off, Y_AXIS);
+  output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
   return output;
 }
 
index 66c4a6cbba908f886575b9675c50141b2d334292..22b4cec9726bf09fa4e441a8008ed2973306ec9a 100644 (file)
@@ -24,7 +24,7 @@ struct Atom {
   Atom (String, Box);
   Atom ();
   void translate (Offset o);
-  void translate (Real r,Axis a);
+  void translate_axis (Real r,Axis a);
   /// how big is #this#?
   Box extent() const;
   void print() const;
index fae403280c0bd95244e4698dff94b21ed53dd3f6..f5057a0c630428ccc13457856285c07626ba1619 100644 (file)
@@ -57,7 +57,7 @@ public:
     translate in one direction
     */
     
-  void translate (Real, Axis);
+  void translate_axis (Real, Axis);
 
   Real relative_coordinate (Axis_group_element*group, Axis) const;
   Offset absolute_offset() const;
index f83eda517b87b5fe50fe00b186181736b604c3a2..ddea093d0e455e42414caf290d1f4b041e06bd51 100644 (file)
@@ -28,7 +28,7 @@ struct Molecule {
   
   void add (Molecule const &m);
   void translate (Offset);
-  void translate (Real,Axis);
+  void translate_axis (Real,Axis);
   void add (Atom const & a) ;
   /// how big is #this#? 
   Box extent() const;
index 2d24d07959568fa89eb61694559f1a45e28dd3dc..a2ddd1b43e848447170e96078acc06ceb8b671bb 100644 (file)
@@ -25,6 +25,8 @@ Local_key_item::Local_key_item (int i)
 void
 Local_key_item::add_support (Item*head_l)
 {
+  if (support_items_.find_l(head_l))
+    return ;
   support_items_.push (head_l);
   add_dependency (head_l);
 }
@@ -70,18 +72,17 @@ Local_key_item::brew_molecule_p() const
          if (octave_mol_p)
            {
              Real dy =lastoct*7*paper()->internote_f ();
-             octave_mol_p->translate (dy, Y_AXIS);
+             octave_mol_p->translate_axis (dy, Y_AXIS);
              output->add (*octave_mol_p);
              delete octave_mol_p;
            }
          octave_mol_p= new Molecule;
        }
       lastoct = accs[i].octave_i_;
-      
       Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f ();
       Atom a (paper()->lookup_l ()->accidental (accs[i].accidental_i_));
-      a.dim_[X_AXIS] += 1 PT; // todo
-      a.translate (dy, Y_AXIS);
+
+      a.translate_axis (dy, Y_AXIS);
       Molecule m(a);
       octave_mol_p->add_at_edge (X_AXIS, RIGHT, m);
     }
@@ -89,7 +90,7 @@ Local_key_item::brew_molecule_p() const
   if (octave_mol_p)
     {
       Real dy =lastoct*7*paper()->internote_f ();
-      octave_mol_p->translate (dy, Y_AXIS);
+      octave_mol_p->translate_axis (dy, Y_AXIS);
       output->add (*octave_mol_p);
       delete octave_mol_p;
     }
@@ -100,8 +101,22 @@ Local_key_item::brew_molecule_p() const
       Molecule m (paper()->lookup_l ()->fill (b));
       output->add_at_edge (X_AXIS, RIGHT, m);
     }
-  Interval head_width=itemlist_width (support_items_);
-  output->translate (-output->extent().x ().right + head_width.left , X_AXIS);
+
+  Interval x_int;
+  for (int i=0; i < support_items_.size(); i++) 
+    {
+      Axis_group_element *common = 
+       common_group (support_items_[i], X_AXIS);
+
+      Real x = support_items_[i]->relative_coordinate (common, X_AXIS)  
+       -relative_coordinate (common, X_AXIS);
+
+      x_int.unite (x + support_items_[i]->width());
+    }
+  if (x_int.empty_b ())
+    x_int = Interval(0,0);
+  
+  output->translate_axis (-output->extent()[X_AXIS][RIGHT] + x_int[LEFT], X_AXIS);
   
   return output;
 }
index 64153dc8e704a66ec040a171c165e97db0a1e3cb..38e31d9000f82f1ffd91453bc6ff3c2634bc4788 100644 (file)
@@ -132,7 +132,7 @@ Lookup::clef (String s) const
 }
  
 Atom
-Lookup::dots (int j) const
+Lookup::dots () const
 {
   return (*symtables_)("dots")->lookup ("dot");
 }
@@ -193,11 +193,10 @@ Lookup::hairpin (Real &wid, bool decresc) const
 }
 
 Atom
-Lookup::linestaff (int lines, Real wid) const
+Lookup::linestaff (int lines, Real interline_f, Real wid) const
 {
-  Real internote_f = paper_l_ ->internote_f();
   Atom s;
-  Real dy = (lines >0) ? (lines-1)*internote_f : 0;
+  Real dy = (lines >0) ? (lines-1)*interline_f : 0;
   s.dim_ = Box (Interval (0,wid), Interval (0,dy));
 
   Array<String> a;
@@ -207,6 +206,9 @@ Lookup::linestaff (int lines, Real wid) const
   s.tex_ = (*symtables_)("param")->lookup ("linestaf").tex_;
   s.tex_ = substitute_args (s.tex_, a);
 
+
+  s.translate_axis (-s.extent ()[Y_AXIS].center (), Y_AXIS);
+
   return s;
 }
 
index 346ade0301a1a41a13d4a2142e60898cf335ad0f..182658cd5f5fefd77d81001b954e69003928366a 100644 (file)
@@ -37,7 +37,7 @@ Lyric_engraver::do_process_requests()
     {
       lyric_item_p_ =  new Text_item (lreq_l_->tdef_p_);
 
-      lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS);
+      lyric_item_p_->translate_axis (paper()->note_width ()/2 , X_AXIS);
       lyric_item_p_->dir_ = DOWN;
       lyric_item_p_->fat_b_ = true;
       announce_element (Score_elem_info (lyric_item_p_, lreq_l_));
index 0c4d4e0ad168b13cd0a9cf891b249d3b26ac63ff..97df812358c2a56859358ca299c7aa04417e41fe 100644 (file)
@@ -14,6 +14,7 @@ Molecule*
 Meter::brew_molecule_p() const
 {
   Atom s = paper()->lookup_l ()->meter (args);
+  s.translate_axis (-s.extent()[Y_AXIS].center (), Y_AXIS);
   return new Molecule (Atom (s));
 }
 
index 6dc7dab8584483e009377c3f8c4cec8764ee4a8d..d186608b2628766e76bf5d8cc88734cf792f3d96 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  rest.cc -- implement 
+  rest.cc -- implement Rest
 
   source file of the GNU LilyPond music typesetter
 
 void
 Rest::do_add_processing ()
 {
-  if (balltype_i_ == 0)
-    position_i_ += 4;
-  else if (balltype_i_ == 1)
-    position_i_ += 4;
+  if (balltype_i_ != 0 && balltype_i_ != 1)
+    position_i_ -= 4;
+
   Rhythmic_head::do_add_processing ();
   if (dots_l_)
       dots_l_->position_i_ = position_i_;
@@ -34,14 +33,12 @@ Rest::Rest ()
 Molecule *
 Rest::brew_molecule_p () const
 {
-  int staff_size_i_ =8;
-  bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
-  if  (balltype_i_ < 0 || balltype_i_ > 1)
-    streepjes_b = false;
+  int staff_size_i_ = 8;
+  bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&  (balltype_i_ == 0 || balltype_i_ == 1);
   
   Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
   Molecule * m = new Molecule ( Atom (s));
-  m->translate (position_i_ *  paper ()->internote_f (), Y_AXIS);
+  m->translate_axis (position_i_ *  paper ()->internote_f (), Y_AXIS);
   return m;
 }
 
index df80dabd37045b38f865d7d2b0f2425420776f21..2ac99301990edf59749788b714db94bf14aa1f69 100644 (file)
@@ -102,8 +102,8 @@ Script::brew_molecule_p() const
   Real dx = paper()->note_width()/2;
   
   Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_));
-  out->translate (dy * pos_i_, Y_AXIS);
-  out->translate (dx, X_AXIS); // FIXME! ugh
+  out->translate_axis (dy * pos_i_, Y_AXIS);
+  out->translate_axis (dx, X_AXIS);    // FIXME! ugh
   return out;
 }
 
index 6076dd7d86255a75838af5eb77523ccd5f93a291..a73c27df42de1ed3eedd4926d12607d3022eeca6 100644 (file)
@@ -110,7 +110,7 @@ Span_bar::brew_molecule_p() const
 
   Atom s = get_bar_sym (y_int.length());
   Molecule*output = new Molecule (Atom (s));
-  output->translate (y_int[-1], Y_AXIS);
+  output->translate_axis (y_int[-1], Y_AXIS);
   return output;
 }
 
index 58783600f581f5cdf311904d9f33a833cb2a128e..8ea4ba4a5df9c481ea1a64a0f08c35a47fec94f6 100644 (file)
@@ -69,7 +69,7 @@ Lookup::half_slur_middlepart (Real &dx, Direction dir) const
 
   f +=String ("{") + String (idx) + "}";
   s.tex_ = f;
-  s.translate (dx/2, X_AXIS);
+  s.translate_axis (dx/2, X_AXIS);
 
   return s;
 }
@@ -206,7 +206,7 @@ Lookup::slur (int dy , Real &dx, Direction dir) const
   s.tex_ = f;
 
 
-  s.translate (dx/2, X_AXIS);
+  s.translate_axis (dx/2, X_AXIS);
   return s;    
 }
 
@@ -239,7 +239,7 @@ Lookup::big_slur (int dy , Real &dx, Direction dir) const
   mol.add_at_edge (X_AXIS, RIGHT, a);
   mol.add_at_edge (X_AXIS, RIGHT, r);
 
-  mol.translate (l_dy * internote_f, Y_AXIS);
+  mol.translate_axis (l_dy * internote_f, Y_AXIS);
   Atom s;
   s.tex_ = mol.TeX_string();
   s.dim_ = mol.extent();
index 4701f2b10983c6616c6b164e3bbeb90a31fb7665..8d62ea72896dd97d231c54e3b6ef5ff41b2dbc0f 100644 (file)
@@ -51,8 +51,8 @@ Text_item::brew_molecule_p() const
   Molecule* mol_p = new Molecule (a);
 
   if (dir_<0)          // should do something better anyway.
-    mol_p->translate (-mol_p->extent().y ().left , Y_AXIS);
-  mol_p->translate (pos_i_ * paper()->internote_f (), Y_AXIS);
+    mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS);
+  mol_p->translate_axis (pos_i_ * paper()->internote_f (), Y_AXIS);
   
   return mol_p;
 }
index 4f83ba1b7b8539e75683339f9b01651f1453ee7f..8cc0ecfd499a09323583acb90889a91b49de6f9f 100644 (file)
@@ -22,10 +22,10 @@ Vertical_align_element::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
   int i;
   while ((i = elem_l_arr_.find_i (o))>=0) 
-       if (n) 
-           elem_l_arr_[i] = n;
-       else
-           elem_l_arr_.del (i);
+    if (n) 
+      elem_l_arr_[i] = n;
+    else
+      elem_l_arr_.del (i);
 }
 
 /**
@@ -40,18 +40,18 @@ Vertical_align_element::do_post_processing()
   Array<Interval> dims;
   for (int i=0; i < elem_l_arr_.size(); i++) 
     {
-       Interval y = elem_l_arr_[i]->height() ;
-       if (y.empty_b())
-           y = Interval (0,0);
+      Interval y = elem_l_arr_[i]->height() ;
+      if (y.empty_b())
+       y = Interval (0,0);
        
-       dims.push (y);
+      dims.push (y);
     }
 
   Real where_f=0;
   for (int i=0 ;  i < elem_l_arr_.size(); i++) 
     {
-       elem_l_arr_[i]->translate (- dims[i][1] - where_f, Y_AXIS);
-       where_f += dims[i].length();
+      elem_l_arr_[i]->translate_axis (- dims[i][1] - where_f, Y_AXIS);
+      where_f += dims[i].length();
     }
 }