]> git.donarmstrong.com Git - lilypond.git/commitdiff
fluffhouse
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 17 Jun 2002 16:46:30 +0000 (16:46 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 17 Jun 2002 16:46:30 +0000 (16:46 +0000)
ChangeLog
lily/include/tuplet-bracket.hh
lily/piano-pedal-engraver.cc
lily/text-spanner.cc
lily/tuplet-bracket.cc
scm/grob-description.scm
scm/grob-property-description.scm

index 75789d5973014d4d56f73c97f8154164a58f7008..ab0f437ee58fb8c92b2d0250ff2caa9a32742de9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-17  Chris Jackson <chris@fluffhouse.org.uk>
+
+       * lily/tuplet-bracket.cc:
+       * lily/text-spanner.cc: 
+       * lily/piano-pedal-engraver.cc: 
+       * scm/grob-description.scm: 
+       * scm/grob-property-description.scm: Changed the
+       edge-width property of brackets to edge-widen. Changed the sign of
+       the left element of edge-widen so a pair of equal numbers produces
+       a symmetrical bracket.
+
 2002-06-17  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * ly/espanol.ly: added.
index dc301fa05e10681251e34a11f9e7f07f2c0d2b00..8dbc2321845aef8f2139bcd110bd12a1b7fa4ec9 100644 (file)
@@ -32,10 +32,9 @@ public:
 
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
   static Molecule make_bracket (Axis protusion_axis,
-                               Real dx, Real dy, Real thick, Real left_height,
-                               Real right_height, Real gap, Real left_widen,
-                               Real right_widen, Real left_shorten, 
-                               Real right_shorten);
+                               Real dx, Real dy, Real thick, Drul_array<Real> height,
+                               Real gap, Drul_array<Real> widen,
+                               Drul_array<Real> shorten);
   static Direction get_default_dir (Grob*);
 };
 
index 5af7b0e4b237cadc2d6982d0b8fbbb68e96feb23..f754b7481d43a878907dfdb9cc439f332d2be95a 100644 (file)
@@ -72,7 +72,7 @@ private:
 
   /*
     Left and right flare widths of a \___/, as specified by the grob
-    property edge-width.
+    property edge-widen.
    */
   Drul_array<SCM> edge_width_drul_;
   
@@ -310,9 +310,9 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
        Set properties so that the molecule-creating function will
        know whether the right edge should be flared ___/
        */
-      SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-width"));
+      SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-widen"));
       SCM eright = (p->req_l_drul_[START]  ? edge_width_drul_[RIGHT] : gh_double2scm (0));
-      p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+      p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
       
       p->finished_bracket_p_ = p->bracket_p_;
       p->bracket_p_ = 0;
@@ -332,7 +332,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
        know whether the left edge should be flared \___
       */
 
-      SCM ew = p->bracket_p_->get_grob_property ("edge-width");
+      SCM ew = p->bracket_p_->get_grob_property ("edge-widen");
       edge_width_drul_[LEFT] =  ly_car (ew);
       edge_width_drul_[RIGHT] = ly_cdr (ew);
       
@@ -340,7 +340,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
                    edge_width_drul_[LEFT]  :
                    gh_double2scm (0));
       SCM eright = gh_double2scm (0);
-      p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+      p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
 
       /* Set this property for 'mixed style' pedals,    Ped._______/\ ,  
         so the molecule function will shorten the ____ line by the length of the Ped. text.
index fbefe9911ba1465be4dc2e235dd9c9adc76fdd95..f4ab3b524730b2e987a296923b4d7d0b998e527e 100644 (file)
@@ -144,7 +144,7 @@ Text_spanner::brew_molecule (SCM smob)
   
   Drul_array<Molecule> edge_line;
   s = me->get_grob_property ("edge-height");
-  SCM ew = me->get_grob_property ("edge-width");
+  SCM ew = me->get_grob_property ("edge-widen");
   if (gh_pair_p (s))
     {
       Direction d = LEFT;
@@ -152,7 +152,7 @@ Text_spanner::brew_molecule (SCM smob)
       do
        {
          Real dx = ( gh_pair_p (ew)  ? 
-                     gh_scm2double (index_cell (ew, d)) * - dir  :  
+                     gh_scm2double (index_cell (ew, d)) * d :  
                      0 );
          Real dy = gh_scm2double (index_cell (s, d)) * - dir;
          if (dy)
@@ -206,7 +206,7 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
   Drul_array<Real> height, width, shorten, r;
 
   SCM pa = me->get_grob_property ("if-text-padding");
-  SCM ew = me->get_grob_property ("edge-width");
+  SCM ew = me->get_grob_property ("edge-widen");
   SCM eh = me->get_grob_property ("edge-height");
   SCM sp = me->get_grob_property ("shorten-pair");
   
@@ -230,7 +230,7 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
       height[d] =  0;
       shorten[d] = 0;
       if ( ly_number_pair_p (ew) )
-       width[d] +=  gh_scm2double (index_cell (ew, d)) * d;
+       width[d] +=  gh_scm2double (index_cell (ew, d));
       if ( !broken[d] && (ly_number_pair_p (eh) ) )
        height[d] += gh_scm2double (index_cell (eh, d));
       if ( ly_number_pair_p (sp) )
@@ -276,7 +276,7 @@ Text_spanner::setup_pedal_bracket(Spanner *me)
     }
 
   me->set_grob_property ("edge-height", ly_interval2scm (height));
-  me->set_grob_property ("edge-width",  ly_interval2scm(width));
+  me->set_grob_property ("edge-widen",  ly_interval2scm(width));
   me->set_grob_property ("shorten-pair", ly_interval2scm (shorten));
 }
 
@@ -287,9 +287,9 @@ struct Pianopedal
 };
 ADD_INTERFACE (Pianopedal,"piano-pedal-interface",
               "",
-              "pedal-type edge-width edge-height shorten-pair text-start left-widen right-widen");
+              "pedal-type edge-widen edge-height shorten-pair text-start left-widen right-widen");
 
 ADD_INTERFACE (Text_spanner,"text-spanner-interface",
               "generic text spanner",
-              "dash-period if-text-padding dash-length edge-height edge-width edge-text shorten-pair type");
+              "dash-period if-text-padding dash-length edge-height edge-widen edge-text shorten-pair type");
 
index b1c70bff62e920010a53d3aba199049c0b3bc2a7..e458287cc75cdf7f9f3c19a48d5cfc356d241e8b 100644 (file)
@@ -163,7 +163,7 @@ Tuplet_bracket::brew_molecule (SCM smob)
        lt *= gh_scm2double (thick);
       
       SCM gap = me->get_grob_property ("gap");
-      SCM ew = me->get_grob_property ("edge-width");
+      SCM ew = me->get_grob_property ("edge-widen");
       SCM eh = me->get_grob_property ("edge-height");
       SCM sp = me->get_grob_property ("shorten-pair");
       
@@ -172,9 +172,9 @@ Tuplet_bracket::brew_molecule (SCM smob)
       do {
        width[d] =  height[d] = shorten[d] = 0.0;
        if ( ly_number_pair_p (ew) )
-         width[d] +=  gh_scm2double (index_cell (ew, d)) * d;
+         width[d] +=  gh_scm2double (index_cell (ew, d));
        if ( ly_number_pair_p (eh) )
-         height[d] += gh_scm2double (index_cell (eh, d));
+         height[d] += gh_scm2double (index_cell (eh, d)) * - dir;
        if ( ly_number_pair_p (sp) )
          shorten[d] +=  gh_scm2double (index_cell (sp, d));
       }
@@ -182,10 +182,10 @@ Tuplet_bracket::brew_molecule (SCM smob)
       
       Molecule brack = make_bracket (Y_AXIS,
                                     w, ry - ly, lt,
-                                    -height[LEFT]*dir, -height[RIGHT]*dir,
+                                    height,
                                     gh_scm2double (gap),
-                                    width[LEFT], width[RIGHT],
-                                    shorten[LEFT], shorten[RIGHT]);
+                                    width,
+                                    shorten);
       mol.add_molecule (brack);
     }
   
@@ -196,46 +196,43 @@ Tuplet_bracket::brew_molecule (SCM smob)
 
 /*
   should move to lookup?
-
-  argh. this interface is confusing : we have a shorten as well as a
-  widen.
-
-  arg. should use drul_arrays here.
  */
 Molecule
 Tuplet_bracket::make_bracket (Axis protusion_axis,
-                             Real dx, Real dy, Real thick, Real left_height,
-                             Real right_height,
+                             Real dx, Real dy, Real thick, Drul_array<Real> height,
                              Real gap,
-                             Real left_widen, Real right_widen,
-                             Real left_shorten, Real right_shorten)
+                             Drul_array<Real> widen,
+                             Drul_array<Real> shorten)
 {
   Real len = Offset (dx,dy).length ();
   Real gapx = dx * (gap /  len);
   Real gapy = dy * (gap /  len);
-  Real lshortx = dx * (left_shorten /  len);
-  Real lshorty = dy * (left_shorten /  len);
-  Real rshortx = dx * (right_shorten /  len);
-  Real rshorty = dy * (right_shorten /  len);
+  Drul_array<Real> shortx, shorty;
+  Direction d = LEFT;
+  do {
+    shortx[d] = dx * (shorten[d] /  len);
+    shorty[d] = dy * (shorten[d] /  len);
+  }
+  while (flip (&d) != LEFT);
   Axis other = other_axis (protusion_axis);
   
-  Molecule l1 = Lookup::line (thick, Offset(lshortx, lshorty),
+  Molecule l1 = Lookup::line (thick, Offset(shortx[LEFT], shorty[LEFT]),
                              Offset ( (dx - gapx)/2, (dy - gapy)/2 ));
 
   Molecule l2 = Lookup::line (thick, Offset((dx + gapx) / 2,(dy + gapy) / 2),
-                             Offset (dx - rshortx, dy - rshorty));
+                             Offset (dx - shortx[RIGHT], dy - shorty[RIGHT]));
 
   Offset protusion;
-  protusion[other] = -left_widen;
-  protusion[protusion_axis] = left_height;
+  protusion[other] = -widen[LEFT];
+  protusion[protusion_axis] = height[LEFT];
   Molecule p1 = Lookup::line (thick, 
-                             Offset(lshortx, lshorty), 
-                             Offset(lshortx, lshorty) + protusion);
-  protusion[other] = right_widen;
-  protusion[protusion_axis] = right_height;
+                             Offset(shortx[LEFT], shorty[LEFT]), 
+                             Offset(shortx[LEFT], shorty[LEFT]) + protusion);
+  protusion[other] = widen[RIGHT];
+  protusion[protusion_axis] = height[RIGHT];
   Molecule p2 = Lookup::line (thick, 
-                             Offset(dx - rshortx, dy - rshorty), 
-                             Offset(dx - rshortx, dy - rshorty) + protusion);  
+                             Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]), 
+                             Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]) + protusion);  
 
   Molecule m;
   m.add_molecule (p1);
@@ -489,5 +486,5 @@ Tuplet_bracket::add_column (Grob*me, Item*n)
 
 ADD_INTERFACE (Tuplet_bracket,"tuplet-bracket-interface",
   "A bracket with a number in the middle, used for tuplets.",
-  "note-columns edge-width edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
+  "note-columns edge-widen edge-height shorten-pair padding gap left-position right-position bracket-visibility number-visibility thickness direction");
 
index b5443afc47239d79597c6ec880ccd26494d405b3..8e10acd5958f5293f627c48681c8a99f34df17d7 100644 (file)
        (width-correct . 0)
        (outer . #t)
        (direction . -1)
-       (edge-width . (0.5 . 0.5))
+       (edge-widen . (0.5 . 0.5))
        (edge-height . (1.0 . 1.0))
        (shorten-pair . (0.0 . 0.0))
        (thickness .  1.0)
        (gap . 2.0)
        (padding . 0.9)
        (thickness . 1.6)
-       (edge-width . (0.0 . 0.0))
+       (edge-widen . (0.0 . 0.0))
        (edge-height . (0.7 . 0.7))
        (shorten-pair . (-0.2 . -0.2))
        (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
index c878c0cdcfb44a0df83cd17e24452c06454830b8..d8d36e5467530fae7b6a3289ed114cda35cc9889 100644 (file)
@@ -133,7 +133,7 @@ mean centre distance weighted per note
 (grob-property-description 'dot-count integer? "number of dots.")
 (grob-property-description 'duration-log integer? "2-log of the notehead duration, i.e. 0=whole note, 1 = half note, etc.")
 (grob-property-description 'edge-height pair? "a cons that specifies the heights of the vertical edges '(LEFT-height . RIGHT-height).")
-(grob-property-description 'edge-width pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
+(grob-property-description 'edge-widen pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
 (grob-property-description 'edge-text pair? "a cons that specifies the texts to be set at the edges '(LEFT-text . RIGHT-text).")
 (grob-property-description 'elements list? "list of grobs, type depending on the Grob where this is set in.")
 (grob-property-description 'expand-limit integer? "maximum number of measures expanded in church rests.")
@@ -204,7 +204,7 @@ For barline, space after a thick line.")
 (grob-property-description 'right-head ly-grob? "")
 (grob-property-description 'left-head ly-grob? "")
 
-(grob-property-description 'left-widen boolean? "Whether the left edge of a piano pedal bracket should be widened by the first element of edge-width.")
+(grob-property-description 'left-widen boolean? "Whether the left edge of a piano pedal bracket should be widened by the first element of edge-widen.")
 
 (grob-property-description 'length number? "Stem length for unbeamed stems, only for user override.")
 (grob-property-description 'lengths list? "Stem length given multiplicity of flag.")
@@ -278,7 +278,7 @@ as a real penalty.")
 (grob-property-description 'raise number? "height for text to be raised (a negative value lowers the text.")
 (grob-property-description 'right-padding number? "space right of accs.")
 (grob-property-description 'right-trim-amount number? "shortening of the lyric extender on the right.")
-(grob-property-description 'right-widen boolean? "Whether the right edge of a piano pedal bracket should be widened by the second element of edge-width")
+(grob-property-description 'right-widen boolean? "Whether the right edge of a piano pedal bracket should be widened by the second element of edge-widen")
 (grob-property-description 'script-priority number? "A sorting key that determines in what order a script is within a stack of scripts.")
 (grob-property-description 'self-alignment-X number-or-grob? "real number: -1 =
 left aligned, 0 = center, 1 right-aligned in X direction.