]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.94.jcn1
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 8 Oct 2000 17:47:27 +0000 (19:47 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 8 Oct 2000 17:47:27 +0000 (19:47 +0200)
1.3.94.jcn1
===========

* Added backend framework for arpeggios.

* Fixes for les-nereides.  Should we do asymmetric slurs...?

1.3.94
======

12 files changed:
CHANGES
VERSION
input/les-nereides.ly
input/test/arpeggio.ly [new file with mode: 0644]
lily/arpeggio-engraver.cc [new file with mode: 0644]
lily/arpeggio.cc [new file with mode: 0644]
lily/include/arpeggio.hh [new file with mode: 0644]
lily/include/span-arpeggio.hh [new file with mode: 0644]
lily/span-arpeggio-engraver.cc [new file with mode: 0644]
lily/span-arpeggio.cc [new file with mode: 0644]
lily/span-bar.cc
ly/engraver.ly

diff --git a/CHANGES b/CHANGES
index e414a5881f66d471d1be5ceaa35b44b2c7a8e294..6c8d88a90e39d3dee38946d63464678f97db4b63 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+1.3.94.jcn1
+===========
+
+* Added backend framework for arpeggios.
+
+* Fixes for les-nereides.  Should we do asymmetric slurs...?
+
+1.3.94
+======
+
 1.3.93.uu1
 ==========
 
diff --git a/VERSION b/VERSION
index 38473d7230f2e4b5c99248ad4f063879f88c6e94..b7cebea8a56864185a6712432e4414f4587c277b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=94
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 0fe82491342d111e80ba84f1c189c6619fb53d68..4c4500e90d64db3ffc601fd7ac405690c7a0317b 100644 (file)
@@ -1,3 +1,8 @@
+%{
+cpp -P -traditional -o l.ly les-nereides.ly
+cpp -P -traditional -o l-fake.ly  -DFAKE_GRACE les-nereides.ly
+%}
+
 \header{
     composer =   "ARTHUR GRAY";
     title =      "LES N\\'ER\\'EIDES";
@@ -15,190 +20,184 @@ global = \notes{
     \skip 2;
     \skip 1*2;
 
-    %\skip 1;
-
-    % fake grace
+#ifndef FAKE_GRACE
+    \skip 1;
+#else % FAKE_GRACE
     \skip 2.; \partial 32*24;
     \skip 32*24;
-    %end fake grace
+#endif % FAKE_GRACE
 
     \bar "||";
 }
 
 treble = \context Voice=treble \notes\relative c''{
+    % Broken?
+    \property Voice.NoteColumn \push #'horizontal-shift = #0
     r2
     %2
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #1
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #1
     r4 <cis eis a cis> r2
     %3
     r4 <cis fis a cis> r8.
     \translator Staff=bass
-    cis,16^2^"m.g."( <fis8 fis,\sustainup> <e! e,!>
+    cis,16^2^"m.d."( <fis8 fis,> <e! e,!>
     %4
     <)dis,4 a' dis>
     \translator Staff=treble
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #1
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #1
     %% 8va
-    cis''''4 (
+    cis''''4^"m.g." (
 
-%{
+#ifndef FAKE_GRACE
 
-    \property basicStemProperties \pop #'direction
-    % ugh
-    \property Voice.basicStemProperties \push #'direction = #0
+    \property Voice.Stem \pop #'direction
 
     % grace is a mess
     % maybe we should fake this and put 5/4 in this bar?
 
     \grace {
         )cis8
-       \property basicStemProperties \pop #'direction
-       \property Grace.basicStemProperties \push #'direction = #0
+       \property Grace.Stem \pop #'direction
+       \property Grace.Stem \push #'direction = #0
        %urg, dim. during grace dumps core here
-        %%[a16-5( fis dis] [cis'32 a-1 fis-4 dis\>] [cis a )\!fis-2]
+        %%[a16-5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2]
         [a16-5( fis dis] [cis32 a-1 fis-4 dis] [cis a )fis-2]
     }
 
-%}
+#else % FAKE_GRACE 
 
-    %% fake grace:
-    \property basicNoteHeadProperties \pop #'font-size
-    \property basicStemProperties \pop #'font-size
-    \property basicBeamProperties \pop #'font-size
-    \property basicTextScriptProperties \pop #'font-size
-    \property basicSlurProperties \pop #'font-size
-    \property basicLocalKeyProperties \pop #'font-size
-
-    \property Voice.basicNoteHeadProperties \push #'font-size = #-1
-    \property Voice.basicStemProperties \push #'font-size = #-1
-    \property Voice.basicBeamProperties \push #'font-size = #-1
-    \property Voice.basicTextScriptProperties \push #'font-size = #-1
-    \property Voice.basicSlurProperties \push #'font-size = #-1
-    \property Voice.basicLocalKeyProperties \push #'font-size = #-1
+    \property Voice.NoteHead \push #'font-size = #-1
+    \property Voice.Stem \push #'font-size = #-1
+    \property Voice.Beam \push #'font-size = #-1
+    \property Voice.TextScript \push #'font-size = #-1
+    \property Voice.Slur \push #'font-size = #-1
+    \property Voice.LocalKey \push #'font-size = #-1
 
     )cis16
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #0
-    %%[a16^5( fis dis] [cis'32 a-1 fis-4 dis\>] [cis a )fis-2] s s s
-    [a16^5( fis dis] [cis32 a^1 fis^4 dis\>] [cis a )fis-2] s % s s
-
-    \property basicNoteHeadProperties \pop #'font-size
-    \property basicStemProperties \pop #'font-size
-    \property basicBeamProperties \pop #'font-size
-    \property basicTextScriptProperties \pop #'font-size
-    \property basicSlurProperties \pop #'font-size
-    \property basicLocalKeyProperties \pop #'font-size
-
-    %ugh ugh
-    \property Voice.basicNoteHeadProperties \push #'font-size = #0
-    \property Voice.basicStemProperties \push #'font-size = #0
-    \property Voice.basicBeamProperties \push #'font-size = #0
-    \property Voice.basicTextScriptProperties \push #'font-size = #0
-    \property Voice.basicSlurProperties \push #'font-size = #0
-    \property Voice.basicLocalKeyProperties \push #'font-size = #0
-    %% end fake grace
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #0
+    %%[a16^5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2] s s s
+    [a16^5( fis dis] [cis32 a^1 fis^4 dis] [cis a )fis-2] s % s s
 
+    \property Voice.NoteHead \pop #'font-size
+    \property Voice.Stem \pop #'font-size
+    \property Voice.Beam \pop #'font-size
+    \property Voice.TextScript \pop #'font-size
+    \property Voice.Slur \pop #'font-size
+    \property Voice.LocalKey \pop #'font-size
 
+#endif % FAKE_GRACE
     
 
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #1
-    \!cis'4()bis
-    r8\mf-"a tempo"
-    <a'8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e r|
-    r\mf <a8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e r|
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #1
+    cis'4()bis
+    r8
+    <a'8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e^" "^1^4^5 r|
+    r<a8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e r|
 }
 
 trebleTwo = \context Voice=trebleTwo \notes\relative c''{
-    \skip 2;
-    \skip 1*2;
-    \skip 4;
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #-1
+    % Broken?
+    \property Voice.NoteColumn \push #'horizontal-shift = #-1
+    s2
+    s1*2
+    s4
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #-1
     <cis4 a fis dis>
 
-    %% fake grace
-    \skip 32*16;
-    %% end fake grace
+#ifdef FAKE_GRACE
+    s32*16
+#endif
 
-    <e2-"rall." g, e d>
+    <e2 g, e d>
+    %r8 cis4. d4 [<cis8-5-4( e,-1> <b-3 d,-1> |
     r8 cis4. d4 [<cis8( e,> <b-3 d,-1> |
-    <)a-2 cis,-1>] cis4. d4 [<cis8(\> e,> <b d,> |
-    <\!)a cis,>]
+    <)a-2 cis,-1>] cis4. d4 [<cis8( e,> <b d,> |
+    <)a cis,>]
 }
 
 bass = \context Voice=bass \notes\relative c{
-    \property Voice.basicSlurProperties \push #'details =
-        #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 5.0))
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #-1
+    \property Voice.Slur \pop #'details
+    \property Voice.Slur \push #'details =
+%        #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 1.0))
+        #'((height-limit . 6.0) (ratio . 0.333) (force-blowfit . 1.0) (beautiful . 0.1))
+    \property Voice.Slur \pop #'de-uglify-parameters
+    \property Voice.Slur \push #'de-uglify-parameters =
+%    #'(1.5  0.8  -2.0)
+    #'(2.4  0.8  4.0)
+    \property Voice.Stem \pop #'direction
+    \property Voice.Slur \push #'direction = #-1
     % huh, auto-beamer?
-    r8. e,16-2\f( [<a8 a,> <b b,>] <cis4\sustaindown cis,> |
+    r8. e,16-2( [<a8 a,> <b b,>] <cis4 cis,> |
     %2
     \translator Staff=treble
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #-1
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #-1
     \property Voice.slurEndAttachment = #'stem
     <)a''4 eis cis> 
     %\stemboth
     \property Voice.slurEndAttachment = ##f
     \translator Staff=bass
-    \property basicStemProperties \pop #'direction
-    % ugh
-    \property Voice.basicStemProperties \push #'direction = #'0
-    r8. cis,,16(\sustainup <fis8 fis,> <gis gis,>
+    \property Voice.Stem \pop #'direction
+    \property Voice.Slur \pop #'y-free
+    \property Voice.Slur \push #'y-free = #0.1
+    r8. cis,,16( <fis8 fis,> <gis gis,>
     %3
-    <a4\sustaindown a,>
+    \property Voice.Stem \pop #'length
+    \property Voice.Stem \push #'length = #5
+    <a4 a,>
     \translator Staff=treble
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #-1
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #-1
     <)a' fis cis>
     \translator Staff=bass
-    \property basicStemProperties \pop #'direction
-    % ugh
-    \property Voice.basicStemProperties \push #'direction = #'0
+    \property Voice.Stem \pop #'direction
     r2
     %4
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #-1
-    <b,,4\sustaindown b,>
+    \property Voice.Slur \pop #'details
+    \property Voice.Slur \push #'details =
+        #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5))
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #-1
+    <b,,4 b,>
     \clef treble;
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #0
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #0
     <
         %urg: staff-change: ! on dis
         <cis'' a fis dis!>
-%      { s8. \sustainup\clef bass;}
+%      { s8. \clef bass;}
     >
-    %\grace { s16 s s s s32 s s s s \clef bass; s }
-    %\clef bass;
-    %\grace { <e,,,32\sustaindown( e,> } <)gis'2 e>
 
-    %% fake grace
-    s4 s8 s32 s \sustainup s \clef bass; s
-    %% end fake grace
+#ifndef FAKE_GRACE
+    %Hmm
+    %\grace { s16 s s s s32 s s s s \clef bass; s }
+    \clef bass;
+#else
+    s4 s8 s32 s  s \clef bass; s
+#endif
 
-    \grace { <e,,,32( e,> } <)gis'2\sustaindown e>
-    %5
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #1
-    \property Staff.stopStartSustain = #""
-    a,8\sustainup\sustaindown [e'-5(<)a-2 cis-3>]
-    \property Staff.stopStartSustain = #"-P"
-     r b,-5\sustainup\sustaindown <e4-3 gis-5 d'>
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #0
-    [e,8-5(\sustainup|
+    \grace { <e,,,32( e,> } <)gis'2 e>
+    %5%
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #1
+    a,8 [e'-5(<)a-2 cis-3>]
+    r b,-5 <e4-3 gis-5 d'>
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #0
+    [e,8-5(|
     %6
-    )a-2\sustaindown]
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #1
-    [e'(<)a cis>] r b,\sustainup\sustaindown <e4 gis d'>
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #0
-    [e,8(\sustainup|
+    )a-2]
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #1
+    [e'(<)a cis>] r b, <e4 gis d'>
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #0
+    [e,8(|
     %7
     )a]
 }
@@ -208,16 +207,73 @@ bassTwo = \context Voice=bassTwo \notes\relative c{
     \skip 1*2;
     \skip 2;
 
-    %% fake grace
+#ifdef FAKE_GRACE
     \skip 32*16;
+#endif
 
-    \property basicStemProperties \pop #'direction
-    \property Voice.basicStemProperties \push #'direction = #1
-    \property basicSlurProperties \pop #'direction
-    \property Voice.basicSlurProperties \push #'direction = #1
+    \property Voice.Stem \pop #'direction
+    \property Voice.Stem \push #'direction = #1
+    \property Voice.Slur \pop #'direction
+    \property Voice.Slur \push #'direction = #1
     cis'4()bis
 }
 
+middleDynamics = \context Dynamics=middle \notes{
+    s8 s16 s\f s4
+    s1*2
+    %4
+    s2
+
+#ifdef FAKE_GRACE
+    s32*12
+    s32\> s s \!s
+#endif
+
+    s32 s-"rall." s s
+    s8 s4
+
+    s1\mf-"a tempo"
+    s8 s8\mf s4 s4 s8\> s32 s s \!s
+}
+
+lowerDynamics = \context Dynamics=lower \notes{
+    s2
+    %2
+    s2\sustaindown s8. s16\sustainup s4
+    %3
+    s2\sustaindown s8. s16\sustainup s4
+    %3
+
+#ifndef FAKE_GRACE
+    s4\sustaindown s16
+    s32 s s\sustainup s
+    s32\sustaindown s s s
+    s8
+#else
+    s2\sustaindown
+    s32*12
+    s32 s s\sustainup s
+    s32\sustaindown s s s
+#endif
+
+    \property Dynamics.stopSustain = #""
+    s4 s16. s32\sustainup
+
+    %5
+    s8\sustaindown s s
+    \property Dynamics.stopSustain = #"*"
+    \property Dynamics.stopStartSustain = #"-P"
+    s s\sustainup\sustaindown s s
+    s\sustainup
+
+    %6
+    \property Dynamics.stopStartSustain = #""
+    s8\sustaindown s s
+    \property Dynamics.stopStartSustain = #"-P"
+    s s\sustainup\sustaindown s s
+    s\sustainup
+}
+
 \score{
     \context PianoStaff <
         \context Staff=treble <
@@ -225,21 +281,67 @@ bassTwo = \context Voice=bassTwo \notes\relative c{
            \treble
            \trebleTwo
         >
+       \context Dynamics=middle <
+           \global
+           \middleDynamics
+       >
         \context Staff=bass <
            \clef bass;
            \global
            \bass
            \bassTwo
         >
+       \context Dynamics=lower <
+           \global
+           \lowerDynamics
+       >
     >
     \paper {
        \translator {
            \ScoreContext
-           basicTimeSignatureProperties \push #'style = #"C"
+           TimeSignature \push #'style = #"C"
+        }
+       \translator {
+           \type "Engraver_group_engraver";
+           \name Dynamics;
+           Generic_property_list = #generic-lyrics-properties
+           \consists "Property_engraver";
+           DynamicsMinimumVerticalExtent = #(cons -3 -3)
+
+           startSustain = #"Ped."
+           stopSustain = #"*"
+           stopStartSustain = #"*Ped."
+           startUnaChorda = #"una chorda"
+           stopUnaChorda = #"tre chorde"
+           % should make separate lists for stopsustain and startsustain 
+           
+           \consists "Piano_pedal_engraver";
+           \consists "Script_engraver";
+           \consists "Dynamic_engraver";
+           \consists "Text_engraver";
+           %GURGURGU, text is initialised using TextScript
+           TextScript \push #'style = #"italic"
+           TextScript \push #'font-size = #2
+           \consists "Skip_req_swallow_translator";
+
+           \consistsend "Axis_group_engraver";
+       }
+
+       \translator {
+           \VoiceContext
+           TextScript \push #'style = #"italic"
+        }
+       \translator {
+           \PianoStaffContext
+           \accepts Dynamics;
+           % aarg, also separates Dynamics context...
+           %VerticalAlignment \push #'threshold = #'(12 . 12) 
+           %VerticalAlignment \pop #'threshold
+           VerticalAlignment \push #'threshold = #'(1 . 10) 
         }
        \translator {
            \GraceContext
-           basicStemProperties \push #'flag-style = #""
+           Stem \push #'flag-style = #""
         }
     }
 }
diff --git a/input/test/arpeggio.ly b/input/test/arpeggio.ly
new file mode 100644 (file)
index 0000000..8b81878
--- /dev/null
@@ -0,0 +1,20 @@
+\score{
+    \context StaffGroup < 
+    %< 
+         \context Staff=one \notes\relative c''{
+             f,
+             <f, a c>
+         }
+         \context Staff=two \notes\relative c{
+             \clef bass;
+             g
+             <g b d>
+         }
+    >
+    \paper{
+       \translator{
+           \StaffContext
+           \consists Arpeggio_engraver;
+       }
+    }
+}
diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc
new file mode 100644 (file)
index 0000000..dccb27e
--- /dev/null
@@ -0,0 +1,74 @@
+/*   
+  arpeggio-engraver.cc -- implement Arpeggio_engraver
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#include "engraver.hh"
+#include "group-interface.hh"
+#include "item.hh"
+#include "arpeggio.hh"
+#include "stem.hh"
+
+class Arpeggio_engraver : public Engraver
+{
+public:
+  VIRTUAL_COPY_CONS (Translator);
+  Arpeggio_engraver ();
+
+protected:
+  virtual void acknowledge_element (Score_element_info);
+  virtual void process_acknowledged ();
+  virtual void do_pre_move_processing ();
+
+private:
+  Item* arpeggio_; 
+  Link_array <Score_element> stems_;
+};
+
+Arpeggio_engraver::Arpeggio_engraver ()
+{
+  arpeggio_ = 0;
+}
+
+void
+Arpeggio_engraver::acknowledge_element (Score_element_info info)
+{
+  if (Stem::has_interface (info.elem_l_))
+    {
+      stems_.push (info.elem_l_);
+    }
+}
+
+void
+Arpeggio_engraver::process_acknowledged ()
+{
+  if (!arpeggio_ && !stems_.empty ())
+    {
+      arpeggio_ = new Item (get_property ("Arpeggio"));
+      Pointer_group_interface pgi (arpeggio_, "stems");
+      for (int i = 0; i < stems_.size (); i++)
+       {
+         pgi.add_element (stems_[i]);
+         arpeggio_->add_dependency (stems_[i]);
+       }
+      announce_element (arpeggio_, 0);
+    }
+}
+
+void
+Arpeggio_engraver::do_pre_move_processing ()
+{
+  if (arpeggio_)
+    {
+      typeset_element (arpeggio_);
+      arpeggio_ = 0;
+    }
+  stems_.clear ();
+}
+
+
+ADD_THIS_TRANSLATOR (Arpeggio_engraver);
+
diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc
new file mode 100644 (file)
index 0000000..7500ef8
--- /dev/null
@@ -0,0 +1,50 @@
+/*   
+  arpegggio.cc -- implement Arpeggio
+
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "arpeggio.hh"
+#include "score-element.hh"
+#include "stem.hh"
+#include "staff-symbol-referencer.hh"
+
+bool
+Arpeggio::has_interface (Score_element* me)
+{
+  return me && me->has_interface (ly_symbol2scm ("arpeggio-interface"));
+}
+
+MAKE_SCHEME_CALLBACK (Arpeggio, brew_molecule, 1);
+SCM 
+Arpeggio::brew_molecule (SCM smob) 
+{
+  Score_element *me = unsmob_element (smob);
+  
+  Interval iv; 
+  for (SCM s = me->get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element *stem = unsmob_element (gh_car (s));
+      iv.unite (Stem::head_positions (stem));
+    }
+
+  Molecule mol;
+  Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot");
+  Real half_space = Staff_symbol_referencer::staff_space (me) / 2;
+  for (Real i = iv[MIN]; i <= iv[MAX]; i++)
+    {
+      Molecule d (dot);
+      d.translate_axis (i * half_space, Y_AXIS);
+      mol.add_molecule (d);
+    }
+  mol.translate (Offset (-3, 0));
+
+  return mol.create_scheme (); 
+}
+
+
diff --git a/lily/include/arpeggio.hh b/lily/include/arpeggio.hh
new file mode 100644 (file)
index 0000000..317027d
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+  arpegio.hh -- declare Arpeggio
+  
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef ARPEGGIO_HH
+#define ARPEGGIO_HH
+
+#include "lily-guile.hh"
+#include "lily-proto.hh"
+
+class Arpeggio
+{
+public:
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  static bool has_interface (Score_element*);
+};
+
+#endif /* ARPEGGIO_HH */
+
diff --git a/lily/include/span-arpeggio.hh b/lily/include/span-arpeggio.hh
new file mode 100644 (file)
index 0000000..a494fbe
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+  span-arpegio.hh -- declare Span_arpeggio
+  
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef SPAN_ARPEGGIO_HH
+#define SPAN_ARPEGGIO_HH
+
+#include "lily-guile.hh"
+#include "lily-proto.hh"
+#include "interval.hh"
+
+class Span_arpeggio
+{
+public:
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  static bool has_interface (Score_element*);
+};
+
+#endif /* SPAN_ARPEGGIO_HH */
+
diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc
new file mode 100644 (file)
index 0000000..8fb13ae
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+  span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "engraver.hh"
+#include "item.hh"
+#include "arpeggio.hh"
+#include "span-arpeggio.hh"
+#include "group-interface.hh"
+
+
+/** 
+
+  Make arpeggios that span multiple staffs.  Catch arpeggios, and span a
+  Span_arpeggio over them if we find more than two arpeggios.
+  */
+class Span_arpeggio_engraver : public Engraver
+{
+public:
+  VIRTUAL_COPY_CONS (Translator);
+  Span_arpeggio_engraver ();
+
+protected:
+  virtual void acknowledge_element (Score_element_info);
+  virtual void process_acknowledged ();
+  virtual void do_pre_move_processing ();
+
+private:
+  Item *span_arpeggio_;
+  Link_array<Score_element> arpeggios_;
+};
+
+
+Span_arpeggio_engraver::Span_arpeggio_engraver ()
+{
+  span_arpeggio_ = 0;
+}
+
+void
+Span_arpeggio_engraver::acknowledge_element (Score_element_info info)
+{
+    if (info.origin_trans_l_arr (this).size ()
+        && Arpeggio::has_interface (info.elem_l_))
+    {
+      arpeggios_.push (info.elem_l_);
+    }
+}
+
+void
+Span_arpeggio_engraver::process_acknowledged ()
+{
+  if (arpeggios_.size () > 1 && !span_arpeggio_) 
+    {
+      span_arpeggio_ = new Item (get_property ("SpanArpeggio"));
+      Pointer_group_interface pgi (span_arpeggio_, "arpeggios");
+      for (int i = 0; i < arpeggios_.size () ; i++)
+       {
+         pgi.add_element (arpeggios_[i]);
+         span_arpeggio_->add_dependency (arpeggios_[i]);
+       }
+      
+      span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS);
+      span_arpeggio_->set_parent (arpeggios_[0], X_AXIS);
+      
+      announce_element (span_arpeggio_, 0);
+    }
+}
+
+void
+Span_arpeggio_engraver::do_pre_move_processing ()
+{
+  if (span_arpeggio_) 
+    {
+      typeset_element (span_arpeggio_);
+      span_arpeggio_ = 0;
+    }
+  arpeggios_.clear ();
+}
+
+ADD_THIS_TRANSLATOR (Span_arpeggio_engraver);
+
diff --git a/lily/span-arpeggio.cc b/lily/span-arpeggio.cc
new file mode 100644 (file)
index 0000000..5a574a8
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+  span-arpeggio.cc -- implement Span_arpeggio
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "axis-group-interface.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "arpeggio.hh"
+#include "span-arpeggio.hh"
+#include "score-element.hh"
+#include "stem.hh"
+#include "staff-symbol-referencer.hh"
+
+bool
+Span_arpeggio::has_interface (Score_element* me)
+{
+  return me && me->has_interface (ly_symbol2scm ("span-arpeggio-interface"));
+}
+
+/*
+  We could collapse this with Arpeggio::brew_molecule, but that requires
+  hairy scm callback hacking.
+ */
+MAKE_SCHEME_CALLBACK (Span_arpeggio, brew_molecule, 1);
+SCM 
+Span_arpeggio::brew_molecule (SCM smob) 
+{
+  Score_element *me = unsmob_element (smob);
+  
+  Interval iv;
+  Score_element *common = me;
+  for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element *arpeggio = unsmob_element (gh_car (s));
+      common = arpeggio->common_refpoint (common, Y_AXIS);
+    }
+  // Hmm, nothing in common?
+  if (0) //(common)
+    for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
+      {
+       Score_element *arpeggio = unsmob_element (gh_car (s));
+       Real c = common->relative_coordinate (arpeggio, Y_AXIS);
+       //iv.unite (Arpeggio::head_positions (stem));
+       iv.unite (Interval (c, c));
+      }
+  else
+    iv = Interval (-23, 5);
+
+  Molecule mol;
+  Molecule dot = me->paper_l ()->lookup_l (0)->afm_find ("dots-dot");
+  Real half_space = Staff_symbol_referencer::staff_space (me) / 2;
+  for (Real i = iv[MIN]; i < iv[MAX]; i++)
+    {
+      Molecule d (dot);
+      d.translate_axis (i * half_space, Y_AXIS);
+      mol.add_molecule (d);
+    }
+  mol.translate (Offset (-6, 0));
+
+  return mol.create_scheme (); 
+}
+
+
index 6f04809e745da3d2c8fdb874cdccd2f27b99c643..189b54ff999e7cb2943a5ed74b4914dd54fa0670 100644 (file)
@@ -145,6 +145,7 @@ Span_bar::get_bar_size (SCM smob)
     }
   return gh_double2scm (iv.length ());
 }
+
 void
 Span_bar::set_interface (Score_element *me)
 {
index b5f51c2f0b120df898d942ea3aa86040336e87bb..de43a4918ed506889abaa129ee57b3c3538dbbd6 100644 (file)
@@ -34,6 +34,8 @@ StaffContext=\translator {
 
        \consists "Piano_pedal_engraver";
 
+%      \consists "Arpeggio_engraver";
+
        \consistsend "Axis_group_engraver";
 
 %{
@@ -191,6 +193,7 @@ GrandStaffContext=\translator{
        \type "Engraver_group_engraver";
        \name GrandStaff;
        \consists "Span_bar_engraver";
+       \consists "Span_arpeggio_engraver";
        \consists "System_start_delimiter_engraver";
        systemStartDelimiterGlyph = #'brace
        
@@ -212,11 +215,13 @@ PianoStaffContext = \translator{\GrandStaffContext
 
 StaffGroupContext= \translator {
        \type "Engraver_group_engraver";
+       \name StaffGroup;
+
        \consists "Span_bar_engraver";
+       \consists "Span_arpeggio_engraver";
        \consists "Output_property_engraver";   
+       systemStartDelimiterGlyph = #'bracket
        \consists "System_start_delimiter_engraver";
-       systemStartDelimiterGlyph = #'bracket
-       \name StaffGroup;
        \accepts "Staff";
        \accepts "RhythmicStaff";
        \accepts "GrandStaff";
@@ -337,6 +342,7 @@ ScoreContext = \translator {
 
        \consists "Lyric_phrasing_engraver";
        \consists "Bar_number_engraver";
+       \consists "Span_arpeggio_engraver";
 
        
        \accepts "Staff";
@@ -433,6 +439,11 @@ ScoreContext = \translator {
        % distances are given in stafflinethickness (thicknesses) and
        % staffspace (distances)
        %
+       Arpeggio = #`(
+               (interfaces . (arpeggio-interface))
+               (molecule-callback . ,Arpeggio::brew_molecule)
+               (name . "arpeggio") 
+       )
        BarLine = #`(
                (interfaces . (bar-interface staff-bar-interface))
                (break-align-symbol . Staff_bar)
@@ -754,7 +765,11 @@ ScoreContext = \translator {
                (maximum-duration-for-spacing . ,(make-moment 1 8))
                (name . "SpacingSpanner")
        )
-
+       SpanArpeggio = #`(
+               (interfaces . (span-arpeggio-interface))
+               (molecule-callback . ,Span_arpeggio::brew_molecule)
+               (name . "SpanArpeggio") 
+       )
        SpanBar = #`(
                (interfaces . (bar-interface span-bar-interface))
                (break-align-symbol . Staff_bar)