]> git.donarmstrong.com Git - lilypond.git/commitdiff
* rehearsalmark-horiz-extent.ly: add note.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 8 Nov 2005 14:23:38 +0000 (14:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 8 Nov 2005 14:23:38 +0000 (14:23 +0000)
* scm/music-functions.scm (glue-mm-rest-texts): also put other
events into EventChord. This fixes textspanners on mm rests.

* lily/side-position-interface.cc (get_axis): read side-axis
(set_axis): set side-axis.

* scm/define-grobs.scm (all-grob-descriptions): add side-axis
properties everywhere.

* lily/spacing-spanner.cc (breakable_column_spacing): add
average-spacing-wishes. Take maximum if not set.
(musical_column_spacing): idem.

* scm/define-grobs.scm (all-grob-descriptions): add average-spacing-wishes.

* lily/grob-closure.cc (add_offset_callback): bugfix: properly add
offset callbacks. This fixes alignment for Fingering objects.

* scm/define-grobs.scm (all-grob-descriptions): tiny bit less
space for key - timesig combination.

* scm/define-grobs.scm (all-grob-descriptions): decrease distance
to key sig.

* scm/define-grobs.scm (all-grob-descriptions): remove
self-X-offset. Fixes alignment of octavate-8.

ChangeLog
lily/axis-group-interface.cc
lily/bar-number-engraver.cc
lily/instrument-name-engraver.cc
lily/side-position-interface.cc
lily/spacing-spanner.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/music-functions.scm

index 3d5a4d904f9a520131760d43d10d542484fcbc7c..0e4bf972ca10c5779552b44563519772c7a2834c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2005-11-08  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/music-functions.scm (glue-mm-rest-texts): also put other
+       events into EventChord. This fixes textspanners on mm rests.
+
+       * lily/side-position-interface.cc (get_axis): read side-axis
+       (set_axis): set side-axis.
+
+       * scm/define-grobs.scm (all-grob-descriptions): add side-axis
+       properties everywhere.
+
+       * lily/spacing-spanner.cc (breakable_column_spacing): add
+       average-spacing-wishes. Take maximum if not set.
+       (musical_column_spacing): idem.
+
+       * scm/define-grobs.scm (all-grob-descriptions): add average-spacing-wishes.
+
        * lily/grob-closure.cc (add_offset_callback): bugfix: properly add
        offset callbacks. This fixes alignment for Fingering objects.
 
index bf92fc4c8f22597fa700c56c4765dde3da47f321..bc386b628e862ff7b42174c106a35b4f8115724c 100644 (file)
@@ -109,4 +109,4 @@ ADD_INTERFACE (Axis_group_interface, "axis-group-interface",
 
               /* properties */
               "axes "
-              "elements");
+              "elements ");
index 9279e16a6a0ae32ff468d6ad987ee5ba97f53a25..31401f029b240281110129cc37f0655cb007973a 100644 (file)
@@ -97,7 +97,6 @@ Bar_number_engraver::create_items ()
     return;
 
   text_ = make_item ("BarNumber", SCM_EOL);
-  Side_position_interface::set_axis (text_, Y_AXIS);
 }
 
 ADD_TRANSLATOR (Bar_number_engraver,
index ec7ee15a9390abaf00243ad4e60d89b5e8485ff8..147578de0be5bc562976def24dbe33d202f461ee 100644 (file)
@@ -85,21 +85,21 @@ Instrument_name_engraver::create_text ()
 }
 
 void
-Instrument_name_engraver::acknowledge_bar_line (Grob_info i)
+Instrument_name_engraver::acknowledge_bar_line (Grob_info info)
 {
-  (void)i;
+  (void) info;
   create_text ();
 }
 
 void
-Instrument_name_engraver::acknowledge_axis_group (Grob_info i)
+Instrument_name_engraver::acknowledge_axis_group (Grob_info info)
 {
   /*
     Ugh - typechecking for pedal and dynamic sucks.
   */
-  if (dynamic_cast<Spanner *> (i.grob ())
-      && (i.grob ()->internal_has_interface (ly_symbol2scm ("dynamic-interface"))
-         || i.grob ()->internal_has_interface (ly_symbol2scm ("piano-pedal-interface"))))
+  if (dynamic_cast<Spanner *> (info.grob ())
+      && (info.grob ()->internal_has_interface (ly_symbol2scm ("dynamic-interface"))
+         || info.grob ()->internal_has_interface (ly_symbol2scm ("piano-pedal-interface"))))
     return;
 
   /*
@@ -111,12 +111,12 @@ Instrument_name_engraver::acknowledge_axis_group (Grob_info i)
     We could also just use stavesFound, but lets keep this working
     without staffs as well.
   */
-  if (dynamic_cast<Spanner *> (i.grob ())
-      && ((Axis_group_interface::has_interface (i.grob ())
-          && Axis_group_interface::has_axis (i.grob (), Y_AXIS)))
-      && !Align_interface::has_interface (i.grob ()))
+  if (dynamic_cast<Spanner *> (info.grob ())
+      && ((Axis_group_interface::has_interface (info.grob ())
+          && Axis_group_interface::has_axis (info.grob (), Y_AXIS)))
+      && !Align_interface::has_interface (info.grob ()))
     {
-      SCM nl = scm_cons (i.grob ()->self_scm (),
+      SCM nl = scm_cons (info.grob ()->self_scm (),
                         get_property ("instrumentSupport"));
 
       context ()->set_property ("instrumentSupport", nl);
@@ -139,6 +139,7 @@ Instrument_name_engraver::process_music ()
 
 ADD_ACKNOWLEDGER (Instrument_name_engraver, bar_line);
 ADD_ACKNOWLEDGER (Instrument_name_engraver, axis_group);
+
 ADD_TRANSLATOR (Instrument_name_engraver,
                /* doc */ " Prints the name of the instrument (specified by "
                " @code{Staff.instrument} and @code{Staff.instr}) "
index 928d0e867970ae1fbf95e9f26a8bd15744559557..7d4ab573d3aad19afc663490a4760149d3232c92 100644 (file)
@@ -208,24 +208,23 @@ Side_position_interface::aligned_side (Grob*me, Axis a)
 void
 Side_position_interface::set_axis (Grob *me, Axis a)
 {
-  add_offset_callback (me,
-                      (a==X_AXIS)
-                      ? x_aligned_side_proc
-                      : y_aligned_side_proc,
-                      a);
+  if (!scm_is_number (me->get_property ("side-axis")))
+    {
+      me->set_property ("side-axis", scm_from_int (a));
+      add_offset_callback (me,
+                          (a==X_AXIS)
+                          ? x_aligned_side_proc
+                          : y_aligned_side_proc,
+                          a);
+    }
 }
-
-// ugh. doesn't catch all variants. 
 Axis
 Side_position_interface::get_axis (Grob *me)
 {
-  if (me->get_property_data (ly_symbol2scm ("X-offset"))
-      == Side_position_interface::x_aligned_side_proc)
-    return X_AXIS;
-  else if (me->get_property_data (ly_symbol2scm ("Y-offset"))
-          == Side_position_interface::y_aligned_side_proc)
-    return Y_AXIS;
-
+  if (scm_is_number (me->get_property ("side-axis")))
+    return Axis (scm_to_int (me->get_property ("side-axis")));
+  
+  programming_error ("side-axis not set.");
   return NO_AXES;
 }
 
@@ -241,6 +240,7 @@ ADD_INTERFACE (Side_position_interface, "side-position-interface",
               "direction-source "
               "minimum-space "
               "padding "
+              "side-axis "
               "side-relative-direction "
               "side-support-elements "
               "slur-padding "
index f56af93598cc577404b9690d27527a2a87922cb2..baa7cd483f584c48ec2d04790b0bd00fbd7d3742 100644 (file)
@@ -246,6 +246,8 @@ Spacing_spanner::musical_column_spacing (Grob *me,
   bool expand_only = false;
   Real base_note_space = note_spacing (me, left_col, right_col, options, &expand_only);
 
+  Real max_fixed = 0;
+  Real max_space = 0;
   Real compound_note_space = 0.0;
   Real compound_fixed_note_space = 0.0;
 
@@ -281,8 +283,12 @@ Spacing_spanner::musical_column_spacing (Grob *me,
 
              Note_spacing::get_spacing (wish, right_col, base_note_space, options->increment_, &space, &fixed);
 
-             compound_note_space = compound_note_space + space;
-             compound_fixed_note_space = compound_fixed_note_space + fixed;
+
+             max_space = max (max_space, space);
+             max_fixed = max (max_fixed, fixed);
+             
+             compound_note_space += space;
+             compound_fixed_note_space += fixed;
              wish_count++;
            }
        }
@@ -301,11 +307,16 @@ Spacing_spanner::musical_column_spacing (Grob *me,
          compound_note_space = base_note_space;
          compound_fixed_note_space = options->increment_;
        }
-      else
+      else if (to_boolean (me->get_property ("average-spacing-wishes")))
        {
          compound_note_space /= wish_count;
          compound_fixed_note_space /= wish_count;
        }
+      else
+       {
+         compound_fixed_note_space = max_fixed;
+         compound_note_space = max_space;
+       }
 
       /*
        Whatever we do, the fixed space is smaller than the real
@@ -356,6 +367,9 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r,
 {
   Real compound_fixed = 0.0;
   Real compound_space = 0.0;
+  Real max_fixed = 0.0;
+  Real max_space = 0.0;
+  
   int wish_count = 0;
 
   Moment dt = Paper_column::when_mom (r) - Paper_column::when_mom (l);
@@ -394,6 +408,9 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r,
              space *= 0.8;
            }
 
+         max_space = max (max_space, space);
+         max_fixed = max (max_fixed, fixed_space);
+         
          compound_space += space;
          compound_fixed += fixed_space;
          wish_count++;
@@ -408,8 +425,17 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r,
     }
   else
     {
-      compound_space /= wish_count;
-      compound_fixed /= wish_count;
+      if (to_boolean (me->get_property ("average-spacing-wishes")))
+       {
+         compound_space /= wish_count;
+         compound_fixed /= wish_count;
+       }
+      else
+       {
+         compound_fixed = max_fixed;
+         compound_space = max_space;
+       }
+      
     }
 
   if (options->stretch_uniformly_ && l->break_status_dir () != RIGHT)
@@ -442,6 +468,7 @@ ADD_INTERFACE (Spacing_spanner, "spacing-spanner-interface",
               "head width) A 16th note is followed by 0.5 note head width. The\n"
               "quarter note is followed by  3 NHW, the half by 4 NHW, etc.\n",
 
+              "average-spacing-wishes "
               "grace-space-factor "
               "spacing-increment "
               "base-shortest-duration "
index 0f730b5c1d335ada1f28bddeebfee0dd7d4c88cb..9695d628b82c1ff6b461e73c3fd6f150455d5be9 100644 (file)
@@ -39,6 +39,7 @@ arrow on the arpeggio squiggly line.")
   
      (auto-knee-gap ,ly:dimension? "If a gap is found between note heads
 where a horizontal beam fits that is larger than this number, make a kneed beam.")
+     (average-spacing-wishes ,boolean? "If set, the spacing wishes are averaged over staves.")
      (axes ,list? "list of axis numbers.
 In the case of alignment grobs, this should contain only one number.")
 
@@ -177,10 +178,7 @@ fret diagram.  Options include @code{none}, @code{in-dot}, and @code{below-strin
 typeset on a Stem. Valid options include @code{()} and
 @code{mensural}.  Additionally, @code{\"no-flag\"} switches off the
 flag.")
-     
-     (strict-note-spacing ,boolean? "If set, unbroken columns
-with non-musical material (clefs, barlines, etc.) are not spaced
-separately, but put before musical columns.")
+
      (font-family ,symbol? "The font family is the broadest category for selecting text fonts. Options include: @code{sans}, @code{roman} ")
      (font-encoding ,symbol? "The font encoding is the broadest
 category for selecting a font. Options include: @code{fetaMusic},
@@ -343,6 +341,9 @@ quicker the slur attains it @code{height-limit}.")
      (remove-first ,boolean? "Remove the first staff of a orchestral score?")
      (right-padding ,ly:dimension? "Space to insert between note and
 accidentals.")
+     (same-direction-correction ,number? "Optical correction amount
+for stems that are placed in tight configurations. This amount is used
+for stems with the same direction to compensate for note-head to stem distance.")
      (script-priority ,number? "A sorting key that determines in what
 order a script is within a stack of scripts.")
 
@@ -368,6 +369,7 @@ note that starts here.")
                              "Multiply direction of
 @code{direction-source} with this to get the direction of this
 object.")
+     (side-axis ,number? "Is this object horizontally or vertically next to another object?")
      (size ,number? "Size of object, relative to standard size.")
      (slope ,number? "The slope of this object.")
      (slur-padding ,number? "Extra distance between slur and script.")
@@ -401,9 +403,9 @@ stems that are placed in tight configurations. For opposite
 directions, this amount is the correction for two normal sized stems
 that overlap completely.")
 
-     (same-direction-correction ,number? "Optical correction amount
-for stems that are placed in tight configurations. This amount is used
-for stems with the same direction to compensate for note-head to stem distance.")
+     (strict-note-spacing ,boolean? "If set, unbroken columns
+with non-musical material (clefs, barlines, etc.) are not spaced
+separately, but put before musical columns.")
      (string-count ,integer? "The number of strings in a fret diagram.")
      (stroke-style ,string? "set to \"grace\" to turn stroke through flag on.")
      
index 958e875f183d872a49cf328bb16a38a5a326ae81..e2c00936f75e652f501667b068ec0c9207fa670c 100644 (file)
@@ -43,6 +43,7 @@
        (direction . ,UP)
        (staff-padding . 0.25)
        (script-priority . 0)
+       (side-axis . ,X)
        (meta . ((class . Item)
                 (interfaces . (side-position-interface
                                script-interface
 
        (stencil . ,Accidental_interface::print)
        (after-line-breaking . ,Accidental_interface::after_line_breaking)
+       (side-axis . ,X)
        
        (meta . ((class . Item)
                 (interfaces . (item-interface
        (X-offset . ,Side_position_interface::x_aligned_side)
        (direction . -1)
        (padding . 0.5)
+       (side-axis . ,X)
        (staff-position . 0.0)
        (meta . ((class . Item)
                 (interfaces . (arpeggio-interface
 
     (BarNumber
      . (
-
        (stencil . ,Text_interface::print)
-       ;
        (breakable . #t)
        (break-visibility . ,begin-of-line-visible)
        (padding . 1.0)
        (font-family . roman)
        (font-size . -2)
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
        (X-offset . ,Self_alignment_interface::x_aligned_on_self)
        (self-alignment-X . 1)
 
        (script-priority . 200)
        ;; todo: add X self alignment?
        (baseline-skip . 2)
+       (side-axis . ,Y)
        (font-series . bold)
        (meta . ((class . Item)
                 (interfaces . (text-script-interface
        (direction . 1)
        (padding . 0.2)
        (staff-padding . 0.25)
+       (side-axis . ,Y)
        (meta . ((class . Item)
                 (interfaces . (side-position-interface
                                self-alignment-interface
        (slur-padding . 0.3)
        (minimum-space . 1.2)
        (direction . -1)
+       (side-axis . ,Y)
 
        (Y-extent . ,Axis_group_interface::height)
        (X-extent . ,Axis_group_interface::width)
     (HorizontalBracket
      . (
        (thickness . 1.0)
-
        (stencil . ,Horizontal_bracket::print)
-
        (Y-offset . ,Side_position_interface::y_aligned_side)
        (padding . 0.2)
        (staff-padding . 0.2)
        (direction . -1)
+       (side-axis . ,Y)
        (bracket-flare . (0.5 . 0.5))
        (meta . ((class . Spanner)
                 (interfaces . (horizontal-bracket-interface
                        (left-edge . (extra-space . 1.0))))
 
        (self-alignment-Y . 0)
-
        (stencil . ,Text_interface::print)
-
        (break-align-symbol . instrument-name)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
+       (side-axis . ,X)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                self-alignment-interface
        (Y-offset . ,Side_position_interface::y_aligned_side)
        (direction . 1)
        (padding . 0.8)
+       (side-axis . ,Y)
        (meta . ((class . Item)
                 (interfaces . (text-interface
                                side-position-interface
     (MeasureGrouping
      . (
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
 
        (stencil . ,Measure_grouping::print)
 
                      `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))
                           ,(ly:make-simple-closure (list Self_alignment_interface::x_centered_on_y_parent)))))
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
+
        (self-alignment-X . 0)
        (direction . 1)
        (padding . 0.4)
        (padding . 0.20)
        (staff-padding . 0.25)
        ;; (script-priority . 0) priorities for scripts, see script.scm
-       (X-offset . ,Self_alignment_interface::centered_on_x_parent)
+       (X-offset . , Self_alignment_interface::centered_on_x_parent)
+       
 
        (stencil . ,Script_interface::print)
        (direction . ,Script_interface::calc_direction)
      . (
 
        (springs-and-rods . ,Spacing_spanner::set_springs)
-
+       (average-spacing-wishes . #t)
        (grace-space-factor . 0.6)
        (shortest-duration-space . 2.0)
        (spacing-increment . 1.2)
        (font-series . bold)
        (padding . 1.0)
        (X-offset . ,Side_position_interface::x_aligned_side)
+       (side-axis . ,X)
        (direction . ,LEFT)
        (meta . ((class . Item)
                 (interfaces . (side-position-interface
        (X-extent . ,Axis_group_interface::height)
 
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
 
        (padding . 1.2)
        (minimum-space . 1.0)
        (axes . (1))
        (X-extent . ,Axis_group_interface::height)
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
        (padding . 1.2)
        (staff-padding . 1.2)
        (minimum-space . 1.0)
        (staff-padding . 0.8)
        (dash-fraction . 0.2)
        (dash-period . 3.0)
+       (side-axis . ,Y)
        (direction . 1)
        (meta . ((class . Spanner)
                 (interfaces . (text-spanner-interface
        (padding . 0.5)
        (direction . 1)
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
        (meta . ((class . Spanner)
                 (interfaces . (text-spanner-interface
                                side-position-interface
        (padding . 0.2)
        (direction . ,LEFT)
        (font-size . -4)
+       (side-axis . ,X)
        (stencil . ,Accidental_interface::print)
        (meta . ((class . Item)
                 (interfaces . (item-interface
        (font-size . -4)
        (stencil . ,parenthesize-elements)
        (direction . ,RIGHT)
+       (side-axis . ,X)
        (padding . 0.3)
        (meta . ((class . Item)
                 (interfaces . (side-position-interface
        (axes . (1))
        (X-extent . ,Axis_group_interface::height)
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
        (padding . 1.2)
        (staff-padding . 1.2)
        (minimum-space . 1.0)
        (break-align-symbol . clef)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
+       (side-axis . ,Y)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                self-alignment-interface
        (padding . 1)
        (font-encoding . fetaNumber)
        (Y-offset . ,Side_position_interface::y_aligned_side)
+       (side-axis . ,Y)
        (thickness . 1.6)  ;;  linethickness
        (edge-height . (2.0 . 2.0)) ;; staffspace;
        (minimum-space . 5)
index 88c02025e2ada547e01a579d05981289eebc5ba7..40e7396c558a9c3d64a991143fd919c082062540 100644 (file)
@@ -367,21 +367,41 @@ i.e.  this is not an override"
   "Check if we have R1*4-\\markup { .. }, and if applicable convert to
 a property set for MultiMeasureRestNumber."
   (define (script-to-mmrest-text script-music)
-    "Extract 'direction and 'text from SCRIPT-MUSIC, and transform into property sets."
+    "Extract 'direction and 'text from SCRIPT-MUSIC, and transform MultiMeasureTextEvent"
     (let ((dir (ly:music-property script-music 'direction))
          (p   (make-music 'MultiMeasureTextEvent
                           'text (ly:music-property script-music 'text))))
       (if (ly:dir? dir)
          (set! (ly:music-property p 'direction) dir))
       p))
+  
   (if (eq? (ly:music-property music 'name) 'MultiMeasureRestMusicGroup)
       (let* ((text? (lambda (x) (memq 'script-event (ly:music-property x 'types))))
-            (es (ly:music-property  music 'elements))
-            (texts (map script-to-mmrest-text  (filter text? es)))
-            (others (remove text? es)))
-       (if (pair? texts)
+            (event? (lambda (x) (memq 'event (ly:music-property x 'types))))
+            (group-elts (ly:music-property  music 'elements))
+            (texts '())
+            (events '())
+            (others '()))
+
+       (set! texts 
+             (map script-to-mmrest-text (filter text? group-elts)))
+       (set! group-elts
+             (remove text? group-elts))
+
+       (set! events (filter event? group-elts))
+       (set! others (remove event? group-elts))
+       
+       (if (or (pair? texts) (pair? events))
            (set! (ly:music-property music 'elements)
-                 (cons (make-event-chord texts) others)))))
+                 (cons (make-event-chord
+                        (append texts events))
+                       others)))
+
+
+       (display-scheme-music (list music))
+
+       ))
+
   music)