]> git.donarmstrong.com Git - lilypond.git/commitdiff
(get_voice_to_lyrics): use NPOS everywhere.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 25 Jan 2006 12:13:29 +0000 (12:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 25 Jan 2006 12:13:29 +0000 (12:13 +0000)
ChangeLog
lily/lyric-engraver.cc
lily/main.cc
lily/midi-stream.cc
lily/misc.cc
lily/pango-font.cc
ly/music-functions-init.ly
scm/layout-page-layout.scm

index 6d86f5d9d5aafd9486f6a2993dc0af0c492a81d2..c6d840e6aa37490a0e3544869d8cdfa70b66c39c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-25  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/lyric-engraver.cc (get_voice_to_lyrics): use NPOS everywhere.
+
 2006-01-25  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * flower/include/std-string.hh: String/std::string compatibility:
@@ -27,6 +31,9 @@
 
 2006-01-25  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/layout-page-layout.scm (write-page-breaks): write
+       \spacingTweaks #ALIST. Handle grace timing.
+
        * scm/: more imports.
 
        * scm/page.scm (make-page): add footer/header.
        * scm/layout-page-layout.scm (write-page-breaks): preliminary
        version of the system/spacing/linebreak hack writing to the output
 
-       * lily/prob-scheme.cc (LY_DEFINE): take optional 'key val args in ly:make-prob.
+       * lily/prob-scheme.cc (LY_DEFINE): take optional 'key val args in
+       ly:make-prob.
 
-       * lily/grob-scheme.cc (LY_DEFINE): ly:spanner-get-bound -> ly:spanner-bound
+       * lily/grob-scheme.cc (LY_DEFINE): ly:spanner-get-bound ->
+       ly:spanner-bound
 
 2006-01-24  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
index fd08fa16dcd9f531d77b1abdf6a7a1953aac66cf..484167c109a4c792166c3c8bb3e76e69ceccd300 100644 (file)
@@ -90,7 +90,7 @@ get_voice_to_lyrics (Context *lyrics)
   else
     {
       int idx = nm.index_last ('-');
-      if (idx >= 0)
+      if (idx != NPOS)
        nm = nm.left_string (idx);
     }
 
index fa0d356f0a90723b041956b3c95cffd50f504307..36ae928b47dc9ac6f72c72594ca36338d52fe27e 100644 (file)
@@ -499,7 +499,7 @@ parse_argv (int argc, char **argv)
            String key = arg;
            String val = "#t";
 
-           if (eq >= 0)
+           if (eq != NPOS)
              {
                key = arg.left_string (eq);
                val = arg.right_string (arg.length () - eq - 1);
index 7af7a10649389afaf6fda77953c7a598319e8b41..b139c8239ea4efb48c6dc3abf863a9bc6d666faf 100644 (file)
@@ -55,7 +55,7 @@ Midi_stream::operator << (Midi_item const &midi_c_r)
   if (do_midi_debugging_global)
     {
       str = String_convert::bin2hex (str) + "\n";
-      for (int i = str.index ("0a"); i >= 0; i = str.index ("0a"))
+      for (int i = str.index ("0a"); i != NPOS; i = str.index ("0a"))
        {
          str[i] = '\n';
          str[i + 1] = '\t';
index a85b43ae57f0247ede586213ebdba3242c5e2b50..d605eb88a5fa9ec3fec46a339da4b9f5a7b0836c 100644 (file)
@@ -49,7 +49,7 @@ split_string (String s, char c)
          continue;
        }
 
-      if (i < 0)
+      if (i == NPOS)
        i = s.length ();
 
       rv.push (s.cut_string (0, i));
index 35eb6cb01ccb78e642f7b27b3549e79b83433044..e97c914b24d9b8230ddf4b9acfc473891157cc7d 100644 (file)
@@ -157,8 +157,8 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const
   String ps_name;
   if (!ps_name_str0
       && file_name != ""
-      && (file_name.index (".otf") >= 0
-         || file_name.index (".cff") >= 0))
+      && (file_name.index (".otf") != NPOS
+         || file_name.index (".cff") != NPOS))
     {
 
       /* UGH: kludge a PS name for OTF/CFF fonts.  */
@@ -169,7 +169,7 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const
       name = name.left_string (idx);
 
       int slash_idx = name.index_last ('/');
-      if (slash_idx >= 0)
+      if (slash_idx != NPOS)
        name = name.right_string (name.length () - slash_idx - 1);
 
       String initial = name.cut_string (0, 1);
index 8a8e24706d27d7adcfd930b838152464396bbf07..77bdedc9fb9f3beb1d950a8372a296c3e357270e 100644 (file)
@@ -309,7 +309,8 @@ assertBeamSlope =
      (append
       (list chain-grob-member-functions `(,cons 0 0))
       (check-slope-callbacks comp))))))
-    
+
+
 parallelMusic =
 #(def-music-function (parser location voice-ids music) (list? ly:music?)
   "Define parallel music sequences, separated by '|' (bar check signs),
@@ -396,4 +397,12 @@ Example:
                                'elements voice)))
         voice-ids voices))
  ;; Return an empty sequence. this function is actually a "void" function.
- (make-music 'SequentialMusic 'void #t))
\ No newline at end of file
+ (make-music 'SequentialMusic 'void #t))
+
+
+
+
+%% this is a stub. Write your own to suit the spacing tweak output.
+spacingTweaks =
+#(def-music-function (parser location parameters) (list?)
+   (make-music 'SequentialMusic 'void #t))
index 1dcf9033e579deed4317404921e924efecb02b3b..96b1265d4a2348e39c1faa12555a5cf285369317 100644 (file)
     (set! tweaks
          (acons when property-pairs
                 tweaks)))
-
+  (define (graceless-moment mom)
+    (ly:make-moment
+     (ly:moment-main-numerator mom)
+     (ly:moment-main-denominator mom)
+     0 0))
+     
   (define (moment->skip mom)
-    (format "s1*~a/~a"
-           (ly:moment-main-numerator mom)
-           (ly:moment-main-denominator mom)))
-  
+    (let*
+       ((main (if (> (ly:moment-main-numerator mom) 0)
+                  (format "\\skip 1*~a/~a"
+                          (ly:moment-main-numerator mom)
+                          (ly:moment-main-denominator mom))
+                  ""))
+        (grace (if (< (ly:moment-grace-numerator mom) 0)
+                   (format "\\grace { \\skip 1*~a/~a }"
+                           (- (ly:moment-grace-numerator mom))
+                           (ly:moment-grace-denominator mom))
+                   "")))
+
+      (format "~a~a" main grace)))
+    
   (define (dump-tweaks out-port tweak-list last-moment)
     (if (not (null? tweak-list))
        (let*
             (diff (ly:moment-sub now last-moment))
             (these-tweaks (cdar tweak-list))
             (skip (moment->skip diff))
-
-            (base (format "\\overrideProperty
-       #\"Score.NonMusicalPaperColumn\"
-       #'line-break-system-details
-        #'~a" these-tweaks))
+            (line-break-str (if (assoc-get 'line-break these-tweaks #f)
+                                "\\break\n"
+                                ""))
+            (page-break-str (if (assoc-get 'page-break these-tweaks #f)
+                                "\\pageBreak\n"
+                                ""))
+            (space-tweaks (format "\\spacingTweaks #'~a\n"
+                                  (with-output-to-string
+                                    (lambda ()
+                                      (pretty-print
+                                  
+                                       (assoc-get 'spacing-parameters these-tweaks '()))))
+                                    ))
+            (base (format "~a~a~a"
+                          line-break-str
+                          page-break-str
+                          space-tweaks))
             )
 
-         (format out-port "\\skip ~a\n~a\n" skip base)
-         (dump-tweaks out-port (cdr tweak-list) now)
-       )
-
-       ))
+         (format out-port "~a\n~a\n" skip base)
+         (dump-tweaks out-port (cdr tweak-list) (graceless-moment now))
+       )))
   
   (define (handle-page page)
+    (define index 0)
     (define (handle-system sys)
       (let*
-         ((props '((line-break . #t))))
+         ((props `((line-break . #t)
+                   (spacing-parameters
+                    . ((system-Y-extent . ,(paper-system-extent sys Y))
+                       (system-refpoint-Y-extent . ,(paper-system-staff-extents sys))
+                       (system-index . ,index)
+                       (page-system-count . ,(length (page-lines page)))
+                       (page-printable-height . ,(page-printable-height page)) 
+                       (page-space-left . ,(page-property page 'space-left))))
+                   )))
 
        (if (equal? (car (page-lines page)) sys)
            (set! props (cons '(page-break . #t)
                              props)))
-
        (if (not (ly:prob-property? sys 'is-title))
            (record (ly:grob-property (ly:spanner-bound (ly:prob-property sys 'system-grob) LEFT) 'when)
                  props))
+
+       (set! index (1+ index))
        ))
     (for-each handle-system (page-lines page)))