CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/08/16 15:47:43

Modified files:
        .              : ChangeLog THANKS 
        Documentation/topdocs: NEWS.tely 
        Documentation/user: basic-notation.itely 
        input          : proportional.ly 
        lily           : break-align-engraver.cc 
                         percent-repeat-engraver.cc separation-item.cc 
        lily/include   : paper-system.hh 
        scm            : define-grobs.scm framework-ps.scm 
Added files:
        input/regression: repeat-percent-count.ly 

Log message:
        * 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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4017&tr2=1.4018&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/THANKS.diff?tr1=1.140&tr2=1.141&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/topdocs/NEWS.tely.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/user/basic-notation.itely.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/proportional.ly.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/regression/repeat-percent-count.ly?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/break-align-engraver.cc.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/percent-repeat-engraver.cc.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/separation-item.cc.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/paper-system.hh.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.222&tr2=1.223&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-ps.scm.diff?tr1=1.131&tr2=1.132&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4017 lilypond/ChangeLog:1.4018
--- lilypond/ChangeLog:1.4017   Tue Aug 16 13:00:23 2005
+++ lilypond/ChangeLog  Tue Aug 16 15:47:40 2005
@@ -1,3 +1,25 @@
+2005-08-16  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
 
        * input/no-notation/display-lily-tests.ly: moved from
Index: lilypond/Documentation/topdocs/NEWS.tely
diff -u lilypond/Documentation/topdocs/NEWS.tely:1.63 
lilypond/Documentation/topdocs/NEWS.tely:1.64
--- lilypond/Documentation/topdocs/NEWS.tely:1.63       Thu Aug 11 13:11:17 2005
+++ lilypond/Documentation/topdocs/NEWS.tely    Tue Aug 16 15:47:41 2005
@@ -38,6 +38,17 @@
 @itemize @bullet
 
 @item
+Percent repeats now get numbers to how many repeats there are.
+
[EMAIL PROTECTED],fragment,raggedright] 
+\repeat percent 4 { c1 }
+\time 2/4
+\repeat percent 4 { c2 c2 }
[EMAIL PROTECTED] lilypond
+
+This feature was sponsored by Yoshinobu Ishizaki
+                  
[EMAIL PROTECTED]
 Text scripts such as fingering instructions and dynamics avoid
 collisions with Slurs
 
Index: lilypond/Documentation/user/basic-notation.itely
diff -u lilypond/Documentation/user/basic-notation.itely:1.36 
lilypond/Documentation/user/basic-notation.itely:1.37
--- lilypond/Documentation/user/basic-notation.itely:1.36       Tue Aug 16 
10:13:17 2005
+++ lilypond/Documentation/user/basic-notation.itely    Tue Aug 16 15:47:41 2005
@@ -2937,7 +2937,9 @@
 
 @seealso
 
-Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
+Program reference: @internalsref{RepeatSlash},
[EMAIL PROTECTED], @internalsref{DoublePercentRepeat},
[EMAIL PROTECTED],
[EMAIL PROTECTED],
 @internalsref{PercentRepeatedMusic}, and
[EMAIL PROTECTED]
 
Index: lilypond/THANKS
diff -u lilypond/THANKS:1.140 lilypond/THANKS:1.141
--- lilypond/THANKS:1.140       Tue Aug  9 02:39:25 2005
+++ lilypond/THANKS     Tue Aug 16 15:47:40 2005
@@ -26,6 +26,7 @@
 Nancho Alvarez
 Sven Axelsson
 Trevor Baca
+Yoshinobu Ishizaki   
 
 
 BUG HUNTERS/SUGGESTIONS
Index: lilypond/input/proportional.ly
diff -u lilypond/input/proportional.ly:1.8 lilypond/input/proportional.ly:1.9
--- lilypond/input/proportional.ly:1.8  Mon Aug 15 21:56:19 2005
+++ lilypond/input/proportional.ly      Tue Aug 16 15:47:41 2005
@@ -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 @@
 
 \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
-   }
-
-   {
-   \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 10/12 {
-    \times 7/6 {
-         c32[ c32 c8 c16] r4
-         c16[ c16 c16. c32
+  \new \staffKind <<
+    {
+      \skip 2
+      \skip 2
+      \break \time 4/8
+      \skip 1 \break \time 4/8
+      \skip 1 \break \time 4/8
     }
-    \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 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]
+    {
+      \time 4/8
 
- }
- { \skip 2 * 6 } % filler space.
- >>
+      \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 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]
+
+    }
+  >>
 >>
Index: lilypond/lily/break-align-engraver.cc
diff -u lilypond/lily/break-align-engraver.cc:1.74 
lilypond/lily/break-align-engraver.cc:1.75
--- lilypond/lily/break-align-engraver.cc:1.74  Fri Aug 12 00:04:47 2005
+++ lilypond/lily/break-align-engraver.cc       Tue Aug 16 15:47:41 2005
@@ -71,7 +71,7 @@
       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: lilypond/lily/include/paper-system.hh
diff -u lilypond/lily/include/paper-system.hh:1.9 
lilypond/lily/include/paper-system.hh:1.10
--- lilypond/lily/include/paper-system.hh:1.9   Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/paper-system.hh       Tue Aug 16 15:47:41 2005
@@ -22,6 +22,7 @@
   DECLARE_SMOBS (Paper_system,);
   Stencil stencil_;
   bool is_title_;
+
 public:
   Interval staff_refpoints_;
   Real break_before_penalty_;
@@ -34,7 +35,7 @@
   bool is_title () const;
   Real break_before_penalty () const;
 };
-//
+
 DECLARE_UNSMOB (Paper_system, paper_system);
 
 #endif /* PAPER_SYSTEM_HH */
Index: lilypond/lily/percent-repeat-engraver.cc
diff -u lilypond/lily/percent-repeat-engraver.cc:1.46 
lilypond/lily/percent-repeat-engraver.cc:1.47
--- lilypond/lily/percent-repeat-engraver.cc:1.46       Mon Aug 15 21:11:12 2005
+++ lilypond/lily/percent-repeat-engraver.cc    Tue Aug 16 15:47:41 2005
@@ -6,6 +6,9 @@
   (c) 2000--2005 Han-Wen Nienhuys <[EMAIL PROTECTED]>
 */
 
+
+#include "score-engraver.hh"
+
 #include "repeated-music.hh"
 #include "global-context.hh"
 #include "warn.hh"
@@ -14,23 +17,16 @@
 #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 @@
   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 @@
 
 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 @@
       && !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 @@
       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 @@
       if (repeat_sign_type_ == DOUBLE_MEASURE)
        next_moment_ += meas_len;
 
+      count_ = 1;
       return true;
     }
 
@@ -127,18 +137,53 @@
 {
   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 @@
 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 @@
 {
   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 @@
   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: lilypond/lily/separation-item.cc
diff -u lilypond/lily/separation-item.cc:1.57 
lilypond/lily/separation-item.cc:1.58
--- lilypond/lily/separation-item.cc:1.57       Sat Aug 13 21:35:22 2005
+++ lilypond/lily/separation-item.cc    Tue Aug 16 15:47:41 2005
@@ -129,6 +129,9 @@
       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: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.222 lilypond/scm/define-grobs.scm:1.223
--- lilypond/scm/define-grobs.scm:1.222 Mon Aug 15 18:06:06 2005
+++ lilypond/scm/define-grobs.scm       Tue Aug 16 15:47:43 2005
@@ -454,6 +454,23 @@
                                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))
@@ -977,6 +994,23 @@
                 (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: lilypond/scm/framework-ps.scm
diff -u lilypond/scm/framework-ps.scm:1.131 lilypond/scm/framework-ps.scm:1.132
--- lilypond/scm/framework-ps.scm:1.131 Mon Aug 15 00:10:29 2005
+++ lilypond/scm/framework-ps.scm       Tue Aug 16 15:47:43 2005
@@ -495,6 +495,7 @@
         (scale (ly:output-def-lookup paper 'outputscale))
         (to-dump-systems '()))
 
+    (display systems)
     ;; skip booktitles.
     (if (and
         (not


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to