]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/tie-single-manual.ly (Module): new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 20 Mar 2006 11:47:13 +0000 (11:47 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 20 Mar 2006 11:47:13 +0000 (11:47 +0000)
* lily/tie-formatting-problem.cc (find_optimal_tie_configuration):
look at has_manual_position_.
(from_ties): set has_manual_position_ if tie has staff-position set.

* lily/tuplet-bracket.cc (calc_positions): idem.

* lily/tuplet-number.cc (print): don't print tupletnumber if it
doesn't span time.

ChangeLog
input/regression/tie-single-manual.ly [new file with mode: 0644]
lily/dynamic-engraver.cc
lily/tie-formatting-problem.cc
lily/tie.cc
lily/tuplet-bracket.cc
lily/tuplet-number.cc

index d5adfe918f9d79e69b44f201a1ef95fcf66399e3..c28e7cf4001015215a3335d954e1f728a91bb11f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-03-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * input/regression/tie-single-manual.ly (Module): new file.
+
+       * lily/tie-formatting-problem.cc (find_optimal_tie_configuration):
+       look at has_manual_position_.
+       (from_ties): set has_manual_position_ if tie has staff-position set.
+
+       * lily/tuplet-bracket.cc (calc_positions): idem.
+
+       * lily/tuplet-number.cc (print): don't print tupletnumber if it
+       doesn't span time.
+
 2006-03-19  Nicolas Sceaux  <nicolas.sceaux@free.fr>
 
        * scm/define-markup-commands.scm (smallCaps): new markup command
diff --git a/input/regression/tie-single-manual.ly b/input/regression/tie-single-manual.ly
new file mode 100644 (file)
index 0000000..ab917b0
--- /dev/null
@@ -0,0 +1,21 @@
+
+\header {
+  texidoc = "Individual ties may be formatted manually by
+specifying their @code{direction} and/or @code{staff-position}."
+  
+}
+
+\version "2.7.39"
+
+\paper {
+  ragged-right = ##t
+}
+
+{
+  \override Tie #'staff-position = #-5.5
+  c'4 ~ c'
+  \override Tie #'staff-position = #-6.5
+  c'4 ~ c'
+  \override Tie #'staff-position = #-7.5
+  c'4 ~ c'
+}
index 8d4cb2880f195d1cd0c819092023872ffb154fb5..3c1a517942d4477fe686d6a29406d33adfd1085f 100644 (file)
@@ -207,15 +207,18 @@ Dynamic_engraver::process_music ()
 
          string start_type
            = ly_symbol2string (current_cresc_ev_->get_property ("name"));
-
-         /*
-           ugh. Use push/pop?
-         */
+         
          if (start_type == "DecrescendoEvent")
            start_type = "decrescendo";
          else if (start_type == "CrescendoEvent")
            start_type = "crescendo";
+         
+                                      
 
+         /*
+           UGH. TODO: should read from original event, so appearance
+           may be altered with \tweak.
+          */
          SCM s = get_property ((start_type + "Spanner").c_str ());
          if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
            {
index 1d6ea31c300d14db12e4936d51d1813e1ed9ed79..439e76cf5069ea5023c0ca5c96b354114876fc2e 100644 (file)
@@ -242,7 +242,13 @@ Tie_formatting_problem::from_ties (vector<Grob*> const &ties)
        }
          
       spec.position_ = Tie::get_position (ties[i]);
-
+      if (scm_is_number (ties[i]->get_property ("staff-position")))
+       {
+         spec.manual_position_ = scm_to_double (ties[i]->get_property ("staff-position"));
+         spec.has_manual_position_ = true;
+         spec.position_ = int (my_round (spec.manual_position_));
+       }
+      
       do
        {
          spec.note_head_drul_[d] = Tie::head (ties[i], d);
@@ -566,6 +572,15 @@ Tie_formatting_problem::find_optimal_tie_configuration (Tie_specification const
   for (int i = 0; i < details_.single_tie_region_size_; i ++)
     {
       confs.push_back (generate_configuration (pos + i * dir, dir));
+      
+      if (spec.has_manual_position_)
+       {
+         confs.back ()->delta_y_
+           = (spec.manual_position_ - spec.position_)
+           * 0.5 * details_.staff_space_;
+
+         break;
+       }
     }
 
   vector<Real> scores;
index cd4591fd5186651593a03a1c3e37e0d87d05d985..bdb7031fcf04ed5959bfca99eadbc134a461c4db 100644 (file)
@@ -71,7 +71,7 @@ Tie::get_position (Grob *me)
     {
       Grob *h = head (me, d);
       if (h)
-       return (int) Staff_symbol_referencer::get_position (h);
+       return (int) rint (Staff_symbol_referencer::get_position (h));
     }
   while (flip (&d) != LEFT);
 
@@ -206,7 +206,7 @@ Tie::calc_control_points (SCM smob)
       (void) yparent->get_property ("positioning-done");
     }
 
-  if (!scm_is_pair (me->get_property ("control-points")))
+  if (!scm_is_pair (me->get_property_data (ly_symbol2scm ("control-points"))))
     {
       set_default_control_points (me);
     }
@@ -288,6 +288,7 @@ ADD_INTERFACE (Tie,
               "direction "
               "line-thickness " 
               "quant-score "
+              "staff-position "
               "thickness "
               );
 
index a0f6ab8588df43b8e0026cf4ffda619eea35a9b5..b812e622e32b8d167bd649e5d2d1dcd9ca489230 100644 (file)
@@ -44,6 +44,8 @@
 #include "spanner.hh"
 #include "staff-symbol-referencer.hh"
 #include "lookup.hh"
+#include "paper-column.hh"
+#include "moment.hh"
 
 static Item *
 get_x_bound_item (Grob *me_grob, Direction hdir, Direction my_dir)
@@ -64,7 +66,8 @@ flatten_number_pair_property (Grob *me,
                              Direction xdir,  SCM sym)
 {
   Drul_array<Real> zero (0, 0);
-  Drul_array<Real> pair = robust_scm2drul (me->internal_get_property (sym), zero);
+  Drul_array<Real> pair
+    = robust_scm2drul (me->internal_get_property (sym), zero);
   pair[xdir] = 0.0;
   
   me->internal_set_property (sym, ly_interval2scm (pair));
@@ -105,7 +108,8 @@ Tuplet_bracket::parallel_beam (Grob *me_grob, vector<Grob*> const &cols, bool *e
       return 0;
     }
 
-  *equally_long = (beam_stems[0] == stems[LEFT] && beam_stems.back () == stems[RIGHT]);
+  *equally_long =
+    (beam_stems[0] == stems[LEFT] && beam_stems.back () == stems[RIGHT]);
   return beams[LEFT];
 }
 
@@ -206,12 +210,16 @@ Tuplet_bracket::calc_control_points (SCM smob)
            x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[RIGHT]
              - overshoot[LEFT];
        }
+      
       else if (d == RIGHT
               && (columns.empty ()
                   || (bounds[d]->get_column ()
                       != dynamic_cast<Item *> (columns.back ())->get_column ())))
        {
          /*
+           We're connecting to a column, for the last bit of a broken
+           fullLength bracket.
+           
            TODO: make padding tunable?
          */
          Real padding = 1.0;
@@ -219,7 +227,9 @@ Tuplet_bracket::calc_control_points (SCM smob)
          if (bounds[d]->break_status_dir ())
            padding = 0.0;
          
-         x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS) [LEFT] - padding;
+         x_span[d]
+           = robust_relative_extent (bounds[d], commonx, X_AXIS) [LEFT]
+           - padding;
        }
     }
   while (flip (&d) != LEFT);
@@ -556,19 +566,11 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
          Real y
            = tuplet_y.linear_combination (d * sign (other_dy));
 
-#if 0
          /*
-           Let's not take padding into account for nested tuplets.
+           We don't take padding into account for nested tuplets.
            the edges can come very close to the stems, likewise for
            nested tuplets?
          */
-         Drul_array<Real> my_height
-           = robust_scm2drul (me->get_property ("edge-height"),
-                              Interval (0, 0));
-         if (dynamic_cast<Spanner *> (tuplets[i])->get_bound (d)
-             == me->get_bound (d))
-           y += dir * my_height[d];
-#endif
 
          points.push_back (Offset (tuplet_x[d] - x0, y));
        }
@@ -622,9 +624,21 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_positions, 1);
 SCM
 Tuplet_bracket::calc_positions (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Spanner *me = unsmob_spanner (smob);
   extract_grob_set (me, "note-columns", columns);
 
+
+  /*
+    Don't print if it doesn't span time.
+   */
+  if (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
+      == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  
   Direction dir = get_grob_direction (me);
   bool equally_long = false;
   Grob *par_beam = parallel_beam (me, columns, &equally_long);
index d04e8f3aadfd4d1f934a5846e142dd483f6d8330..97c49129b3109709be366a60f07f866b29bac58a 100644 (file)
@@ -8,6 +8,8 @@
 */
 
 #include "tuplet-bracket.hh"
+#include "moment.hh"
+#include "paper-column.hh"
 #include "text-interface.hh"
 #include "spanner.hh"
 #include "lookup.hh"
@@ -23,13 +25,30 @@ MAKE_SCHEME_CALLBACK(Tuplet_number, print, 1);
 SCM 
 Tuplet_number::print (SCM smob)
 {
+  Spanner *me = unsmob_spanner (smob);
+  Spanner *tuplet = unsmob_spanner (me->get_object ("bracket")); 
+
+  if (!tuplet || !tuplet->is_live ())
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  /*
+    Don't print if it doesn't span time.
+   */
+  if (robust_scm2moment (tuplet->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
+      == robust_scm2moment (tuplet->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+  
   Stencil *stc = unsmob_stencil (Text_interface::print (smob));
 
   stc->align_to (X_AXIS, CENTER);
   stc->align_to (Y_AXIS, CENTER);
 
-  Spanner *me = unsmob_spanner (smob);
-  Spanner *tuplet = unsmob_spanner (me->get_object ("bracket")); 
   SCM cpoints =  tuplet->get_property ("control-points");
   Drul_array<Offset> points;
   points[LEFT] = ly_scm2offset (scm_car (cpoints));