]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/topdocs/NEWS.tely (Top): add entry for percent
authorhanwen <hanwen>
Tue, 16 Aug 2005 15:47:43 +0000 (15:47 +0000)
committerhanwen <hanwen>
Tue, 16 Aug 2005 15:47:43 +0000 (15:47 +0000)
counters.

* Documentation/user/basic-notation.itely (Measure repeats): add
links to Counter grobs.

* scm/define-grobs.scm (all-grob-descriptions): add
DoublePercentRepeatCounter
(all-grob-descriptions): add PercentRepeatCounter

* lily/percent-repeat-engraver.cc (class Percent_repeat_engraver):
also create counter grobs.

* lily/separation-item.cc (extremal_break_aligned_grob): don't
return grob without space-alist.

* input/proportional.ly: tune staff-padding.

* input/regression/repeat-percent-count.ly: new file.

12 files changed:
ChangeLog
Documentation/topdocs/NEWS.tely
Documentation/user/basic-notation.itely
THANKS
input/proportional.ly
input/regression/repeat-percent-count.ly [new file with mode: 0644]
lily/break-align-engraver.cc
lily/include/paper-system.hh
lily/percent-repeat-engraver.cc
lily/separation-item.cc
scm/define-grobs.scm
scm/framework-ps.scm

index 4a1c8472c151d7e9537ede17ca2fbe91c605cd09..8799e980a44856510eca258eab88b887a410da38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2005-08-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * Documentation/topdocs/NEWS.tely (Top): add entry for percent
+       counters.
+
+       * Documentation/user/basic-notation.itely (Measure repeats): add
+       links to Counter grobs.
+
+       * scm/define-grobs.scm (all-grob-descriptions): add
+       DoublePercentRepeatCounter
+       (all-grob-descriptions): add PercentRepeatCounter
+
+       * lily/percent-repeat-engraver.cc (class Percent_repeat_engraver):
+       also create counter grobs.
+
+       * lily/separation-item.cc (extremal_break_aligned_grob): don't
+       return grob without space-alist.
+
+       * input/proportional.ly: tune staff-padding.
+
+       * input/regression/repeat-percent-count.ly: new file. 
+
 2005-08-16  Nicolas Sceaux  <nicolas.sceaux@free.fr>
 
        * input/no-notation/display-lily-tests.ly: moved from
index 0e7c07adcb6156489e181d6461907a5fef6c3335..30865e919dae0e2aed5e1eaed354fa96d80701b1 100644 (file)
@@ -37,6 +37,17 @@ This document is also available in @uref{source/Documentation/topdocs/out-www/NE
 
 @itemize @bullet
 
+@item
+Percent repeats now get numbers to how many repeats there are.
+
+@lilypond[relative=2,fragment,raggedright] 
+\repeat percent 4 { c1 }
+\time 2/4
+\repeat percent 4 { c2 c2 }
+@end lilypond
+
+This feature was sponsored by Yoshinobu Ishizaki
+                  
 @item
 Text scripts such as fingering instructions and dynamics avoid
 collisions with Slurs
index 5133b865df47a5d308597a342190e55938c753fd..607054fc3d998f6daa58dd99b550c584f36891cb 100644 (file)
@@ -2937,7 +2937,9 @@ Percent repeats must be declared within a @code{Voice} context.
 
 @seealso
 
-Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
+Program reference: @internalsref{RepeatSlash},
+@internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
+@internalsref{DoublePercentRepeatCounter},
+@internalsref{PercentRepeatCounter},
 @internalsref{PercentRepeatedMusic}, and
-@internalsref{DoublePercentRepeat}.
 
diff --git a/THANKS b/THANKS
index d7399bd2c5db9d6d1ec2f1c9acf0d7993fc5596f..f080579f753298500ecea27c90b6849e3cb2e0a9 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -26,6 +26,7 @@ D. Josiah Boothby
 Nancho Alvarez
 Sven Axelsson
 Trevor Baca
+Yoshinobu Ishizaki   
 
 
 BUG HUNTERS/SUGGESTIONS
index 65eb3f211b6f6488219db5c4d202db27b9ba2f2a..db3aecdaf9f2a029e3dc7b5aebcf56d7ca362da5 100644 (file)
@@ -27,7 +27,7 @@
    \override TimeSignature #'break-visibility = #end-of-line-invisible
    \override Beam #'break-overshoot = #'(-0.5 . 1.0)
    \override TupletBracket #'break-overshoot = #'(-0.5 . 1.0)
-   \override TupletBracket #'staff-padding = #4
+   \override TupletBracket #'staff-padding = #3.5
    \override PaperColumn #'used = ##t 
  }
  \context {
@@ -43,87 +43,86 @@ staffKind = "RhythmicStaff"
 
 \relative c''
 \new StaffGroup <<
- \new \staffKind <<
-   {
-     \skip 2
-     \skip 2
-     \break \time 4/8
-     \skip 1 \break \time 4/8
-     \skip 1 \break \time 4/8
-   }
 \new \staffKind <<
+    {
+      \skip 2
+      \skip 2
+      \break \time 4/8
+      \skip 1 \break \time 4/8
+      \skip 1 \break \time 4/8
+    }
 
-   {
-   \time 4/8
+    {
+      \time 4/8
 
-   \times 7/9 {
-     \times 4/6 {
-       r8 c32[ c c c c c c c] r4
-       c32[ c32 c16 }
-       \times 5/4 {
-         c16 c c] c32[ c32 c16 c] r8 }
-     }
+      \times 7/9 {
+       \times 4/6 {
+         r8 c32[ c c c c c c c] r4
+         c32[ c32 c16 }
+         \times 5/4 {
+           c16 c c] c32[ c32 c16 c] r8 }
+      }
 
-\times 10/12 {
-    \times 7/6 {
-         c32[ c32 c8 c16] r4
-         c16[ c16 c16. c32
-    }
-    \times 5/8 {
-         c16 c16 c16. c32] r8 c8[ c8] r4.
-    }
-}
+      \times 10/12 {
+       \times 7/6 {
+         c32[ c32 c8 c16] r4
+         c16[ c16 c16. c32
+            }
+         \times 5/8 {
+           c16 c16 c16. c32] r8 c8[ c8] r4.
+       }
+      }
 
-   \times 4/7 {
-     r8
-     c16[ c16
-       \times 5/4 {
-         c16 r16 c8 c c
-       }
-   }
+      \times 4/7 {
+       r8
+       c16[ c16
+            \times 5/4 {
+              c16 r16 c8 c c
+            }
+          }
 
-   \times 3/4 {
-     c8]
-     c16[ c
-          \times  2/3 {
-            c16 c16]
-          r4 }
-   }
- }
-   >>
- \new \staffKind
- <<
- {
-   \times 9/5 {
-     r8. c16[ c c
-              \grace {
-                \stemDown
-                c32[ c32]
-                \stemNeutral
-              }
-              c16 c c
-     c
-   }
-   \times 4/7 {
-     c16 c c c ]
-     \times 5/4 {
-       c16[ c32 c32]
-       r4
-       c32[ c c16
-     }
-   }
-   \times 10/12 {
-     \times 7/10 {
-       c16 c16 c8] r4 c4
-       c16[ c8 c16 c16 r8 c16
-     }
-     c16 c32 c32]
-     r4.
-     c16.[
-     c32
-   }
-   c16 c16]
+       \times 3/4 {
+         c8]
+       c16[ c
+            \times  2/3 {
+              c16 c16]
+            r4 }
+      }
   }
+  >>
 \new \staffKind
 <<
   {
+      \times 9/5 {
+       r8. c16[ c c
+                \grace {
+                  \stemDown
+                  c32[ c32]
+                  \stemNeutral
+                }
+                c16 c c
+                c
+              }
+       \times 4/7 {
+         c16 c c c ]
+       \times 5/4 {
+         c16[ c32 c32]
+         r4
+         c32[ c c16
+            }
+       }
+       \times 10/12 {
+         \times 7/10 {
+           c16 c16 c8] r4 c4
+         c16[ c8 c16 c16 r8 c16
+            }
+         c16 c32 c32]
+       r4.
+       c16.[
+         c32
+       }
+       c16 c16]
 
- }
- { \skip 2 * 6 } % filler space.
- >>
+    }
+  >>
 >>
diff --git a/input/regression/repeat-percent-count.ly b/input/regression/repeat-percent-count.ly
new file mode 100644 (file)
index 0000000..45666ee
--- /dev/null
@@ -0,0 +1,20 @@
+
+\header {
+
+
+  texidoc = "Percent repeats get numbers to indicate the repeat
+counts, but only if there are more than two repeats."
+
+
+}
+
+\version "2.7.6"
+
+\relative c'' \new Voice {
+  \time 4/4 
+  \repeat "percent" 4 { c1 }
+  \time 2/4 
+  \repeat "percent" 4 { c2 c2 }
+  \repeat "percent" 2 { c2 }
+}
+
index 3359b9b72a710f0be88da2e35f6e4fb475306d66..9fde23e6b779130018762f16b4ec4a88e5df02f7 100644 (file)
@@ -71,7 +71,7 @@ Break_align_engraver::acknowledge_break_aligned (Grob_info inf)
       SCM align_name = item->get_property ("break-align-symbol");
       if (!scm_is_symbol (align_name))
        return;
-
+         
       if (!align_)
        {
          align_ = make_item ("BreakAlignment", SCM_EOL);
index 2c4930b36378ced4f9df08f78c9c9873d4839931..3c9168993e519430e2a661b1245fab98afd1ecc9 100644 (file)
@@ -22,6 +22,7 @@ class Paper_system
   DECLARE_SMOBS (Paper_system,);
   Stencil stencil_;
   bool is_title_;
+
 public:
   Interval staff_refpoints_;
   Real break_before_penalty_;
@@ -34,7 +35,7 @@ public:
   bool is_title () const;
   Real break_before_penalty () const;
 };
-//
+
 DECLARE_UNSMOB (Paper_system, paper_system);
 
 #endif /* PAPER_SYSTEM_HH */
index ba9a627537bdf0a0d6b8b843a86f52fdeddfcda0..bb40c0e45fe197a8702d90429d8e005109ebb051 100644 (file)
@@ -6,6 +6,9 @@
   (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+
+#include "score-engraver.hh"
+
 #include "repeated-music.hh"
 #include "global-context.hh"
 #include "warn.hh"
 #include "item.hh"
 #include "percent-repeat-iterator.hh"
 #include "bar-line.hh"
-#include "score-engraver.hh"
-
-/**
-   This acknowledges repeated music with "percent" style.  It typesets
-   a % sign.
-
-   TODO:
+#include "side-position-interface.hh"
 
-   - BEAT case: Create items for single beat repeats, i.e. c4 / / /
+#include "translator.icc"
 
-   - DOUBLE_MEASURE case: attach a % to an appropriate barline.
-*/
 class Percent_repeat_engraver : public Engraver
 {
   void typeset_perc ();
 public:
   TRANSLATOR_DECLARATIONS (Percent_repeat_engraver);
+  
 protected:
   Music *repeat_;
 
@@ -38,22 +34,28 @@ protected:
   Moment start_mom_;
   Moment stop_mom_;
 
-  /// location  within measure where beam started.
+  /// location within measure where beam started.
   Moment beam_start_location_;
   Moment next_moment_;
   Moment body_length_;
 
-  enum
+  enum Repeat_sign_type
     {
       UNKNOWN,
       MEASURE,
       DOUBLE_MEASURE,
-    }
-    repeat_sign_type_;
+    };
+  Repeat_sign_type repeat_sign_type_;
 
   Item *double_percent_;
-  Spanner *perc_;
-  Spanner *finished_perc_;
+  Item *double_percent_counter_; 
+  Spanner *percent_;
+  Spanner *percent_counter_;
+  Spanner *finished_percent_;
+  Spanner *finished_percent_counter_;
+
+  int count_;
+  int total_count_; 
 protected:
   virtual void finalize ();
   virtual bool try_music (Music *);
@@ -65,11 +67,18 @@ protected:
 
 Percent_repeat_engraver::Percent_repeat_engraver ()
 {
-  perc_ = 0;
-  finished_perc_ = 0;
-  repeat_ = 0;
+  percent_ = 0;
+  percent_counter_ = 0;
+
+  finished_percent_ = 0;
+  finished_percent_counter_ = 0;
 
   double_percent_ = 0;
+  double_percent_counter_ = 0;
+
+  repeat_ = 0;
+  count_ = 0;
+  total_count_ = 0;
 }
 
 bool
@@ -81,11 +90,11 @@ Percent_repeat_engraver::try_music (Music *m)
       && !repeat_)
     {
       body_length_ = Repeated_music::body_get_length (m);
-      int count = Repeated_music::repeat_count (m);
-
+      total_count_ = Repeated_music::repeat_count (m);
+      
       Moment now = now_mom ();
       start_mom_ = now;
-      stop_mom_ = start_mom_ + Moment (count) * body_length_;
+      stop_mom_ = start_mom_ + Moment (total_count_) * body_length_;
       next_moment_ = start_mom_ + body_length_;
 
       Moment meas_len (robust_scm2moment (get_property ("measureLength"), Moment (1)));
@@ -103,7 +112,7 @@ Percent_repeat_engraver::try_music (Music *m)
       repeat_ = m;
 
       Global_context *global = get_global_context ();
-      for (int i = 1; i < count; i++)
+      for (int i = 1; i < total_count_; i++)
        {
          Moment m = next_moment_ + Moment (i) * body_length_;
          global->add_moment_to_process (m);
@@ -116,6 +125,7 @@ Percent_repeat_engraver::try_music (Music *m)
       if (repeat_sign_type_ == DOUBLE_MEASURE)
        next_moment_ += meas_len;
 
+      count_ = 1;
       return true;
     }
 
@@ -127,18 +137,53 @@ Percent_repeat_engraver::process_music ()
 {
   if (repeat_ && now_mom () == next_moment_)
     {
+      count_ ++; 
       if (repeat_sign_type_ == MEASURE)
        {
-         finished_perc_ = perc_;
+         finished_percent_ = percent_;
+         finished_percent_counter_ = percent_counter_;
+         
          typeset_perc ();
-         perc_ = make_spanner ("PercentRepeat", repeat_->self_scm ());
-         SCM col = get_property ("currentCommandColumn");
-         perc_->set_bound (LEFT, unsmob_grob (col));
+         percent_ = make_spanner ("PercentRepeat", repeat_->self_scm ());
+
+         Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+         percent_->set_bound (LEFT, col);
+
+         if (total_count_ > 2)
+           {
+             percent_counter_
+               = make_spanner ("PercentRepeatCounter", repeat_->self_scm ());
+
+
+             SCM text = scm_number_to_string (scm_from_int (count_),
+                                              scm_from_int (10));
+             percent_counter_->set_property ("text", text);
+             percent_counter_->set_bound (LEFT, col);
+             Side_position_interface::add_support (percent_counter_,
+                                                   percent_);
+             percent_counter_->set_parent (percent_, Y_AXIS);
+           }     
        }
       else if (repeat_sign_type_ == DOUBLE_MEASURE)
        {
          double_percent_ = make_item ("DoublePercentRepeat", repeat_->self_scm ());
 
+         if (total_count_ > 2)
+           {
+             double_percent_counter_
+               = make_item ("DoublePercentRepeatCounter",
+                            repeat_->self_scm());
+
+             SCM text = scm_number_to_string (scm_from_int (count_),
+                                              scm_from_int (10));
+             double_percent_counter_->set_property ("text", text);
+
+             Side_position_interface::add_support (double_percent_counter_,
+                                                   double_percent_);
+             double_percent_counter_->set_parent (double_percent_, Y_AXIS);
+             double_percent_counter_->set_parent (double_percent_, X_AXIS);
+           }
+         
          /*
            forbid breaks on a % line. Should forbid all breaks, really.
 
@@ -155,24 +200,32 @@ void
 Percent_repeat_engraver::finalize ()
 {
   typeset_perc ();
-  if (perc_)
+  if (percent_)
     {
       repeat_->origin ()->warning (_ ("unterminated percent repeat"));
-      perc_->suicide ();
+      percent_->suicide ();
+      percent_counter_->suicide();
     }
 }
 
 void
 Percent_repeat_engraver::typeset_perc ()
 {
-  if (finished_perc_)
+  if (finished_percent_)
     {
-      SCM col = get_property ("currentCommandColumn");
-      finished_perc_->set_bound (RIGHT, unsmob_grob (col));
-      finished_perc_ = 0;
+      Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+
+      finished_percent_->set_bound (RIGHT, col);
+      finished_percent_ = 0;
+
+      if (finished_percent_counter_)
+       finished_percent_counter_->set_bound (RIGHT, col);
+    
+      finished_percent_counter_ = 0;
     }
 
   double_percent_ = 0;
+  double_percent_counter_ = 0;
 }
 
 void
@@ -180,13 +233,17 @@ Percent_repeat_engraver::start_translation_timestep ()
 {
   if (stop_mom_ == now_mom ())
     {
-      if (perc_)
+      if (percent_)
        {
-         finished_perc_ = perc_;
+         finished_percent_ = percent_;
+         finished_percent_counter_ = percent_counter_;
+
          typeset_perc ();
        }
       repeat_ = 0;
-      perc_ = 0;
+      percent_ = 0;
+      
+      percent_counter_ = 0;
       repeat_sign_type_ = UNKNOWN;
     }
 }
@@ -197,11 +254,11 @@ Percent_repeat_engraver::stop_translation_timestep ()
   typeset_perc ();
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Percent_repeat_engraver,
                /* doc */ "Make whole bar and double bar repeats.",
-               /* create */ "PercentRepeat DoublePercentRepeat",
+               /* create */
+               "PercentRepeat DoublePercentRepeat "
+               "PercentRepeatCounter DoublePercentRepeatCounter",
                /* accept */ "repeated-music",
                /* read */ "measureLength currentCommandColumn",
                /* write */ "");
index 4b80e14793806f5ef21eda6d9fcd7604e40320ed..ba63f91d0e04e9ab67ae2c4dfeacf994273e3c60 100644 (file)
@@ -129,6 +129,9 @@ Separation_item::extremal_break_aligned_grob (Grob *me,
       if (!scm_is_symbol (break_item->get_property ("break-align-symbol")))
        continue;
 
+      if (!scm_is_pair (break_item->get_property ("space-alist")))
+       continue;
+
       Interval ext = break_item->extent (col, X_AXIS);
 
       if (ext.is_empty ())
index 9f58f662567d3af3f9c3a06d709f5a1825c4418b..af885796625d195ea13f3e169f10edd2411a8ce4 100644 (file)
                                break-aligned-interface
                                percent-repeat-interface))))))
 
+    (DoublePercentRepeatCounter
+     . ((print-function . ,Text_interface::print)
+       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
+                              ,Self_alignment_interface::centered_on_other_axis_parent))
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       (font-encoding . fetaNumber)
+       (self-alignment-X . 0)
+       (font-size . -2) 
+       (direction . 1)
+       (padding . 0.2)
+       (staff-padding . 0.25)
+       (meta . ((class . Item)
+                (interfaces . (side-position-interface
+                               self-alignment-interface
+                               percent-repeat-interface
+                               font-interface
+                               text-interface))))))
     (DynamicLineSpanner
      . (
        (axes . (1))
                 (interfaces . (multi-measure-rest-interface
                                font-interface
                                percent-repeat-interface))))))
+    (PercentRepeatCounter
+     . ((print-function . ,Text_interface::print)
+       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
+                              ,Self_alignment_interface::centered_on_other_axis_parent))
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       (self-alignment-X . 0)
+       (direction . 1)
+       (padding . 0.2)
+       (staff-padding . 0.25)
+       (font-size . -2) 
+       (font-encoding . fetaNumber)
+       (meta . ((class . Spanner)
+                (interfaces . (side-position-interface
+                               self-alignment-interface
+                               percent-repeat-interface
+                               font-interface
+                               text-interface))))))
 
     ;; an example of a text spanner
     (PianoPedalBracket
index b2d8f7c558e066bcd9635301b503e6db3279c096..67ceda359efdc3b90f84aff87b689c3b8d98a3be 100644 (file)
         (scale (ly:output-def-lookup paper 'outputscale))
         (to-dump-systems '()))
 
+    (display systems)
     ;; skip booktitles.
     (if (and
         (not