]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.1.5.jcn2: extender
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 14 Nov 1998 00:51:46 +0000 (01:51 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 14 Nov 1998 00:51:46 +0000 (01:51 +0100)
pl5.jcn2
- extender-*, see input/test/extender.ly
- bf: half-beam length (urg)
- fixes: standchen, star

29 files changed:
NEWS
TODO
VERSION
init/engraver.ly
init/lily.scm
init/table16.ly
init/table20.ly
input/test/extender.ly [new file with mode: 0644]
input/test/hara-kiri.ly
input/test/stars-and-stripes.ly
lily/beam.cc
lily/extender-engraver.cc [new file with mode: 0644]
lily/extender-spanner.cc [new file with mode: 0644]
lily/include/extender-engraver.hh [new file with mode: 0644]
lily/include/extender-spanner.hh [new file with mode: 0644]
lily/include/lily-proto.hh
lily/include/lookup.hh
lily/include/musical-request.hh
lily/include/my-lily-parser.hh
lily/lexer.ll
lily/lookup.cc
lily/musical-request.cc
lily/my-lily-lexer.cc
lily/my-lily-parser.cc
lily/parser.yy
mutopia/standchen.ly
ps/lilyponddefs.ps
tex/lily-ps-defs.tex
tex/lilyponddefs.tex

diff --git a/NEWS b/NEWS
index 8758586337e5ea1a4e88599c81c2057bb9fa857f..98a312d98a4aea8d6a45e767dbb4c82bec09dfa5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+pl5.jcn2
+       - extender-*, see input/test/extender.ly
+       - bf: half-beam length (urg)
+       - fixes: standchen, star
+
 pl5.jcn1
        - tex/lily-ps-defs.tex fixes
        - lily.ps 
diff --git a/TODO b/TODO
index 6b8dc778be8891bbb00608633fc999add3e31539..daf8fa83e653e538f9675e11225c72b0e8ac33b4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,8 +12,6 @@ BUGS:
 
        * latex bla.tex broken (titles / \lilyfooter stuff?)
 
-       * acc placement: \score { \notes \key G; \transpose\notes { a b c } }
-
        * --safe:  disallow backslashes, disallow \include.
 
        * msgfmt -o check?
@@ -88,8 +86,6 @@ BUGS:
 
        * zip target for binary windows dist (JBR)
 
-       * text continuations
-
        * revise documentation
 
        * abbrev -> tremolo
diff --git a/VERSION b/VERSION
index 112493228421c8ebf667fcf8720c1e1124aa9af0..95a012f617c4e0724af6bec0fc7e274dc6d45912 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=1
 PATCH_LEVEL=5
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index aa3a5382bec85b4b98866e9f45bb5d598cc0105e..91db39ae701ef208f86aba6f77693b013d83c619 100644 (file)
@@ -135,6 +135,7 @@ GrandStaffContext=\translator{
        \name LyricVoice ;
        \consists "Separating_line_group_engraver";
        \consists "Lyric_engraver";
+       \consists "Extender_engraver";
        \consists "Beam_req_swallow_translator";
        \consists "Plet_swallow_engraver";
 }
@@ -217,6 +218,7 @@ HaraKiriStaffContext = \translator {
        \accepts "Voice";
 };
 
+% huh, Score should do HaraKiri, not Part yes?
 OrchestralPartStaffContext = \translator {
        \HaraKiriStaffContext
        barColumnPriority = "0";
index 8cd3f0eabe68fd60bdaed30ffe42c79c36c35af7..aadf071f12a16e889eef21e74415ba90c7d34cf6 100644 (file)
 (define
   (experimental-on-tex) "\\turnOnExperimentalFeatures")
 
+(define 
+  (extender o h)
+  ((invoke-output o "invoke-dim1") "extender" h))
+
 (define
   (fatdoublebar o h)
   ((invoke-output o "invoke-dim1") "fatdoublebar" h))
index df5ae32e8cda10d25e56fb28d50cac971aad9cff..d535ebcc10ba8e929095ae52515f1e3d7cbdc2b5 100644 (file)
@@ -64,6 +64,7 @@ table_sixteen=
      "param" = \table {
        "brace" "pianobrace"    1       0.0\pt  0.0\pt  32.0\pt 80.0\pt
        "bracket"       "staffbracket"  1       0.0\pt  4.0\pt  16.0\pt 128.0\pt
+       "extender"      "extender"      1       0.0\pt  0.0\pt  1.0\pt  160.0\pt
        "time_signature"        "generalmeter"  2       0.0\pt  10.0\pt -8.0\pt 8.0\pt
        "rule" "rulesym"        2
        "stem"  "stem"  2
index 2ba75080640dd0d7db3ef69ee150ec49be2a9489..001fce942945be61775d2750e4d9f559f033f4ec 100644 (file)
@@ -67,6 +67,7 @@ table_twenty =
     % dims ignored for this table
     "param" = \table {
        "bracket"       "staffbracket"  1       0.0\pt  0.0\pt  20.0\pt 160.0\pt
+       "extender"      "extender"      1       0.0\pt  0.0\pt  1.0\pt  160.0\pt
        "rule" "rulesym"        2
        "brace"    "pianobrace" 1       0.0\pt  0.0\pt  40.0\pt 100.0\pt         
         "time_signature"       "generalmeter"  2       0.0\pt  10.0\pt -5.0\pt 5.0\pt
diff --git a/input/test/extender.ly b/input/test/extender.ly
new file mode 100644 (file)
index 0000000..ed33ea2
--- /dev/null
@@ -0,0 +1,6 @@
+\score{
+       <
+       \type Staff \notes { c () c () c c }
+       \type Lyrics \lyrics { bla __ alb xxx __ yyy }
+       >
+}
index 49af9b64fdbcb6cfa6b9c2a85e45493ae469b240..89b6cb0682e32a41ec3365d3ba57fb6b3ed4dbbd 100644 (file)
@@ -79,6 +79,11 @@ zagers = \type GrandStaff <
                >
        >
        \paper{
+               \translator { \HaraKiriStaffContext }
+%uh?
+%              \translator { \OrchestralScoreContext }
+%              \translator { \OrchestralPartStaffContext }
+               }
                linewidth = 40.0\mm;
        }
 }
index 8c9f99f51512e32c491a342314d13426c9b3e9f6..9dbecdeb71cc213cffffaee0404f81a21d53e4e4 100644 (file)
@@ -14,49 +14,58 @@ copyright="public domain";
 }
 
 $staff1_voice_1 = \notes {
-  [a8.()fis16] d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8] fis'4.  e'8
-  d'4 cis'2 [b8. cis'16] d'4 d'4 a4 fis4 d4 [a8. fis16] fis4 d4 [fis'8.
-  fis'16] fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4 g'4 g'2 g'4 fis'4. e'8 d'4
-  cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4 d'4 d'4 [d'8()cis'8] b4 b4 b4 e'4 [g'8
-()fis'8] [e'8()d'8] d'4~cis'4 [a8. a16] d'4.~e'8 [fis'8 g'8] a'2 [d'8 e'8]
-  fis'4. g'8 e'4 d'2 s4 }
+  [a8.()fis16] d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8]
+  fis'4.  e'8 d'4 cis'2 [b8. cis'16] d'4 d'4 a4 fis4 d4 [a8. fis16]
+  fis4 d4 [fis'8.  fis'16] fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4
+  g'4 g'2 g'4 fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4
+  d'4 d'4 [d'8()cis'8] b4 b4 b4 e'4 [g'8 ()fis'8] [e'8()d'8]
+  d'4~cis'4 [a8. a16] d'4.~e'8 [fis'8 g'8] a'2 [d'8 e'8] fis'4. g'8
+  e'4 d'2 s4 
+}
 
 $staff1_voice_2 = \notes { 
-  [a8.()fis16] a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2 [e8 e8] a4. a8
-  a4 a2 [a8. a16] a4 a4 a4 fis4 d4 [a8. fis16] fis4 d4 r4 a4 a4 d'4 d'2
-  [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 [a8. a16] d4 d4 d4
-  cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2 [e8. e16] d4.~a8 [a8 a8]
-  a2 [g8 g8] a4. a8 g4 fis2 s4 }
+  [a8.()fis16] a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2 [e8
+  e8] a4. a8 a4 a2 [a8. a16] a4 a4 a4 fis4 d4 [a8. fis16] fis4 d4 r4
+  a4 a4 d'4 d'2 [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 [a8.
+  a16] d4 d4 d4 cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2
+  [e8. e16] d4.~a8 [a8 a8] a2 [g8 g8] a4. a8 g4 fis2 s4 
+}
 
 $staff2_voice_1 = \notes { 
-  r4 fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8] d'4. cis'8
-  d'4 e'2 [e'8. e'16] d'4 d'4 a4 fis4 d4 r4 fis4 d4 r4 d4 e4 fis4 fis'2
-  [e'8 d'8] e'4 e'4 e'4 e'2 cis'4  d'4. cis'8 d'4 e'2 [e'8. e'16] a4 a4
-  e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2 [cis'8. cis'16] a4.~cis'8
-  [d'8 d'8] d'2 [d'8 d'8] d'4. d'8 cis'4 a2 s4 }
+  r4 fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8] d'4.
+  cis'8 d'4 e'2 [e'8. e'16] d'4 d'4 a4 fis4 d4 r4 fis4 d4 r4 d4 e4
+  fis4 fis'2 [e'8 d'8] e'4 e'4 e'4 e'2 cis'4  d'4. cis'8 d'4 e'2
+  [e'8. e'16] a4 a4 e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2
+  [cis'8. cis'16] a4.~cis'8 [d'8 d'8] d'2 [d'8 d'8] d'4. d'8 cis'4
+  a2 s4 
+}
 
 $staff2_voice_2 = \notes { 
-  r4 d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8] d4. e8 [fis8 g8]
-  a2 [g8. g16] fis4 fis4 a4 fis4 d4 r4 fis4 d4 r4 d4 d4 d4 d2 [d8 d8] a4
-  a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16] fis4 d4 e4 a,2 a4 d4 e4 fis4
-  g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2 [g8. g16] fis4.~a,8 [d8 e8] fis2 [b8 b8]
-  a4. a8 a,4 d2 s4 }
+  r4 d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8] d4. e8
+  [fis8 g8] a2 [g8. g16] fis4 fis4 a4 fis4 d4 r4 fis4 d4 r4 d4 d4 d4
+  d2 [d8 d8] a4 a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16] fis4 d4
+  e4 a,2 a4 d4 e4 fis4 g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2 [g8.
+  g16] fis4.~a,8 [d8 e8] fis2 [b8 b8] a4. a8 a,4 d2 s4 
+}
 
 $text1 = \lyrics{
-  Oh4 say. can you see,2 by8. the16 dawn's4 ear- ly light2 What8 so8 proud-4. ly8 we4 hailed,2
-  At8. the16 twi-4 light's last gleam- ing. Whose8. broad16
+  Oh4 __ say. can you see,2 by8. the16 dawn's4 ear- ly light2 What8
+  so8 proud-4. ly8 we4 hailed,2 At8. the16 twi-4 light's last gleam-
+  ing. Whose8. broad16 
 }
 
 $text2 = \lyrics{
-  _4 stripes and bright stars,2 through8 the8 per-4 il- ous fight,2 O'er8 the8 ram-4. parts8
-  we4 watched,2 were8. so16 gal-4 lant- ly _ _ _
+  _4 stripes and bright stars,2 through8 the8 per-4 il- ous fight,2
+  O'er8 the8 ram-4. parts8 we4 watched,2 were8. so16 gal-4 lant- ly
+  _ _ _ 
 }
 
 $text3 = \lyrics{
-  stream-4 ing. And8. the16 rock-4 ets' red glare,2 the8 bombs8 burst-4 ing in air,2 gave4
-  proof4. through8 the4 night2 that8. our16 flag4 was still there,2 Oh4 say, does that
-  star- span- gled ban- ner yet wave,2 O'er8. the16 land2 of8 the8 free2 and8 the8
-  home4. of8 the4 brave.2
+  stream-4 ing. And8. the16 rock-4 ets' red glare,2 the8 bombs8
+  burst-4 ing in air,2 gave4 proof4. through8 the4 night2 that8.
+  our16 flag4 was still there,2 Oh4 say, does that star- span-
+  gled ban- ner yet wave,2 __ O'er8. the16 land2 __ of8 the8 free2
+  and8 the8 home4. of8 the4 brave.2
 }
 
 global = \notes {
@@ -77,9 +86,7 @@ global = \notes {
 \score{ 
        \type GrandStaff < 
                \type Staff=staffA < 
-                       % urg, ugly bug
-                       %\global
-                       \notes \transpose c'' \global
+                       \global
                        \notes \transpose c'' {\voiceone \$staff1_voice_1 } 
                        \notes \transpose c'' {\voicetwo \$staff1_voice_2 } 
                >
index 4982dd3937d32c8599a1f9ffd7e008a43e65ed1c..95151fdf5b6f7d9c8a80a073b599812263100df0 100644 (file)
@@ -641,6 +641,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
   Molecule leftbeams;
   Molecule rightbeams;
 
+  // UGH
+  Real nw_f = paper ()->note_width () * 0.8;
+
   /* half beams extending to the left. */
   if (prev)
     {
@@ -651,7 +654,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
        but let's make sure two half-beams never touch
        */
       Real w = here->hpos_f () - prev->hpos_f ();
-      w = w/2 <? paper ()->note_width ();
+      w = w/2 <? nw_f;
       Atom a;
       if (lhalfs)              // generates warnings if not
        a =  lookup_l ()->beam (sl, w, beam_f);
@@ -684,7 +687,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
              rightbeams.add_atom (b);
            }
          // TODO: notehead widths differ for different types
-         gap_f = paper ()->note_width () / 2;
+         gap_f = nw_f / 2;
          w -= 2 * gap_f;
          a = lookup_l ()->beam (sl, w + stemdx, beam_f);
        }
@@ -696,7 +699,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
          rightbeams.add_atom (b);
        }
 
-      w = w/2 <? paper ()->note_width ();
+      w = w/2 <? nw_f;
       if (rhalfs)
        a = lookup_l ()->beam (sl, w, beam_f);
 
diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc
new file mode 100644 (file)
index 0000000..9201862
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+  extender-engraver.cc -- implement Extender_engraver
+
+  (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "proto.hh"
+#include "musical-request.hh"
+#include "extender-engraver.hh"
+#include "extender-spanner.hh"
+#include "text-def.hh"
+#include "score-column.hh"
+#include "text-item.hh"
+
+IMPLEMENT_IS_TYPE_B1 (Extender_engraver,Engraver);
+ADD_THIS_TRANSLATOR (Extender_engraver);
+
+Extender_engraver::Extender_engraver ()
+{
+  extender_spanner_p_ = 0;
+  span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
+}
+
+void
+Extender_engraver::acknowledge_element (Score_element_info i)
+{
+  Text_item* t = (dynamic_cast<Text_item*> (i.elem_l_));
+  if (!t)
+    return;
+  if (!extender_spanner_p_)
+    return;
+  if (!span_reqs_drul_[LEFT])
+    return;
+
+  if (!extender_spanner_p_->textitem_l_drul_[LEFT])
+    extender_spanner_p_->set_textitem (LEFT, t);
+  else
+    if (span_reqs_drul_[RIGHT] && !extender_spanner_p_->textitem_l_drul_[RIGHT]) 
+      extender_spanner_p_->set_textitem (RIGHT, t);
+}
+
+bool
+Extender_engraver::do_try_request (Request* req_l)
+{
+  Extender_req* p = dynamic_cast <Extender_req *> (req_l);
+  if (!p)
+    return false;
+
+  if (bool (extender_spanner_p_) == bool (p->spantype == Span_req::START))
+    return false;
+
+  Direction d = (!extender_spanner_p_) ? LEFT : RIGHT;
+  if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (req_l))
+    return false;
+
+  span_reqs_drul_[d] = p;
+  span_mom_drul_[d] = get_staff_info ().musical_l ()->when ();
+  return true;
+}
+
+void
+Extender_engraver::do_removal_processing ()
+{
+  if (extender_spanner_p_)
+    {
+      span_reqs_drul_[LEFT]->warning (_ ("unterminated extender"));
+      extender_spanner_p_->unlink ();
+      delete extender_spanner_p_;
+      extender_spanner_p_ = 0;
+      span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
+    }
+}
+
+void
+Extender_engraver::do_process_requests ()
+{
+  if (extender_spanner_p_ || !span_reqs_drul_[LEFT])
+    return;
+
+  extender_spanner_p_ = new Extender_spanner;
+
+  announce_element (Score_element_info (extender_spanner_p_, span_reqs_drul_[LEFT]));
+}
+
+void
+Extender_engraver::do_pre_move_processing ()
+{
+  if (!extender_spanner_p_ || !span_reqs_drul_[RIGHT]) 
+    return;
+
+  typeset_element (extender_spanner_p_);
+  
+  extender_spanner_p_ = 0;
+  span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
+}
+
diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc
new file mode 100644 (file)
index 0000000..d761789
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+  extender-spanner.cc -- implement Extender_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "atom.hh"
+#include "box.hh"
+#include "debug.hh"
+#include "lookup.hh"
+#include "molecule.hh"
+#include "p-col.hh"
+#include "paper-def.hh"
+#include "extender-spanner.hh"
+#include "text-item.hh"
+#include "text-def.hh"
+
+IMPLEMENT_IS_TYPE_B1 (Extender_spanner, Directional_spanner);
+  
+Extender_spanner::Extender_spanner ()
+  : Directional_spanner ()
+{
+  textitem_l_drul_[LEFT] = textitem_l_drul_[RIGHT] = 0;
+  dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0;
+  dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
+}
+
+Extender_spanner::Extender_spanner (Extender_spanner const& c)
+  : Directional_spanner (c)
+{
+  textitem_l_drul_ = c.textitem_l_drul_;
+  dy_f_drul_ = c.dy_f_drul_;
+  dx_f_drul_ = c.dx_f_drul_;
+}
+
+Extender_spanner::~Extender_spanner ()
+{
+}
+
+Offset
+Extender_spanner::center () const
+{
+  Real dx = width ().length ();
+
+  return Offset (dx / 2, 0);
+}
+
+Molecule*
+Extender_spanner::brew_molecule_p () const
+{
+  Molecule* mol_p = new Molecule;
+
+  Real w = width ().length ();
+  
+  w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
+  
+  Atom a = lookup_l ()->extender (w);
+
+  a.translate (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
+
+  mol_p->add_atom (a);
+
+  return mol_p;
+}
+
+void
+Extender_spanner::do_add_processing ()
+{
+  Direction d = LEFT;
+  Drul_array<Text_item *> new_textitem_drul = textitem_l_drul_;
+  do {
+    if (!textitem_l_drul_[d])
+      new_textitem_drul[d] = textitem_l_drul_[(Direction)-d];
+  } while (flip(&d) != LEFT);
+  textitem_l_drul_ = new_textitem_drul;
+}
+
+Interval
+Extender_spanner::do_height () const
+{
+  return Interval (0,0);
+}
+
+void
+Extender_spanner::do_post_processing ()
+{
+  assert (textitem_l_drul_[LEFT] || textitem_l_drul_[RIGHT]);
+
+  // UGH
+  Real nw_f = paper ()->note_width () * 0.8;
+
+  Direction d = LEFT;
+  do
+    {
+      Text_item* t = textitem_l_drul_[d] ? textitem_l_drul_[d] : textitem_l_drul_[(Direction)-d];
+
+      dy_f_drul_[d] += t->height ().length () / 2;
+      if (d == LEFT)
+        dx_f_drul_[d] += t->width ().length ();
+      else
+       dx_f_drul_[d] -= d * nw_f / 2;
+
+//      dx_f_drul_[d] -= d * nw_f / 4;
+    }
+  while (flip(&d) != LEFT);
+}
+
+void
+Extender_spanner::do_substitute_dependency (Score_element* o, Score_element* n)
+{
+  Text_item* new_l = n ? dynamic_cast<Text_item *> (n) : 0;
+  if (dynamic_cast <Item *> (o) == textitem_l_drul_[LEFT])
+    textitem_l_drul_[LEFT] = new_l;
+  else if (dynamic_cast <Item *> (o) == textitem_l_drul_[RIGHT])
+    textitem_l_drul_[RIGHT] = new_l;
+}
+  
+void
+Extender_spanner::set_textitem (Direction d, Text_item* textitem_l)
+{
+  assert (!textitem_l_drul_[d]);
+  textitem_l_drul_[d] = textitem_l;
+  set_bounds (d, textitem_l);
+
+  add_dependency (textitem_l);
+}
+
diff --git a/lily/include/extender-engraver.hh b/lily/include/extender-engraver.hh
new file mode 100644 (file)
index 0000000..e5bb774
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+  extender-engraver.hh -- declare Extender_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef EXTENDER_ENGRAVER_HH
+#define EXTENDER_ENGRAVER_HH
+
+#include "engraver.hh"
+#include "drul-array.hh"
+#include "extender-spanner.hh"
+
+/**
+  Generate an extender.
+  Should make an Extender_spanner that typesets a nice extender line.
+ */
+class Extender_engraver : public Engraver
+{
+public:
+  TRANSLATOR_CLONE(Extender_engraver);
+  DECLARE_MY_RUNTIME_TYPEINFO;
+  Extender_engraver ();
+
+protected:
+  virtual void acknowledge_element (Score_element_info);
+  virtual void do_removal_processing();
+  virtual void do_process_requests();
+  virtual bool do_try_request (Request*);
+  virtual void do_pre_move_processing();
+  
+private:
+  Drul_array<Extender_req*> span_reqs_drul_;
+  Drul_array<Moment> span_mom_drul_;
+  Extender_spanner* extender_spanner_p_;
+};
+
+#endif // EXTENDER_ENGRAVER_HH
diff --git a/lily/include/extender-spanner.hh b/lily/include/extender-spanner.hh
new file mode 100644 (file)
index 0000000..e158237
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  extender-spanner.hh -- part of GNU LilyPond
+
+  (c)  1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef EXTENDER_SPANNER_HH
+#define EXTENDER_SPANNER_HH
+
+#include "directional-spanner.hh"
+
+/** 
+  simple extender line 
+
+  The extender is a simple line at the baseline of the lyric
+  that helps show the length of a melissima (tied/slurred note).
+
+  Extenders must be entered manually for now.
+
+  Although it would be possible for Lily to determine where to
+  put extender lines, it's quite a tricky thing to do.  Also,
+  this would demand quite strict lyrics entries.
+
+  Note: the extender is only used for one-syllable words, or
+  for on a word's last syllable.  The extender should be aligned
+  with the left side of the last note of the melissima, and not
+  extend beond, lasting the whole duration of the melissima
+  (as in MUP, urg).
+  */
+
+class Extender_spanner : public Directional_spanner
+{
+public:
+  Extender_spanner ();
+  virtual ~Extender_spanner ();
+
+  Offset center () const;  
+  void set_textitem (Direction, Text_item*);
+
+  Drul_array<Text_item *> textitem_l_drul_;
+protected:
+  virtual Molecule* brew_molecule_p () const;
+  void do_add_processing ();
+  Interval do_height () const;
+  void do_substitute_dependency (Score_element* o, Score_element* n);
+  void do_post_processing ();
+  DECLARE_MY_RUNTIME_TYPEINFO;
+  SCORE_ELEMENT_CLONE(Extender_spanner);
+
+  Extender_spanner (Extender_spanner const&);
+
+  Drul_array<Real> dy_f_drul_;
+  Drul_array<Real> dx_f_drul_;
+};
+
+#endif // EXTENDER_SPANNER_HH
+
index 0ac8ebf0cca5081a675d3f2893e15374e570f7ad..52f3674b5229c4a42d8ab85bdec88cdfa8f54df5 100644 (file)
@@ -75,6 +75,8 @@ struct Dynamic_req;
 struct Element_group;
 struct Element_group_item;
 struct Engraver_group_engraver;
+struct Extender;
+struct Extender_req;
 struct General_script_def;
 struct Graphical_element;
 
index 9b006156228e3489145355f1b9d60e85449022f7..5b5685a40c6c95ee40b3667d32e5278c0c65bdc7 100644 (file)
@@ -40,6 +40,7 @@ public:
   Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
   Atom dots () const;
   Atom dynamic (String) const;
+  Atom extender (Real) const;
   Atom fill (Box b) const;
   Atom flag (int, Direction) const;
   Atom hairpin (Real width, bool decresc, bool continued) const;
index 1891986303a2d39128a8d44e3d37d812c20ed034..c88ef382c4ba0921214526c3c03e0a9f4bbcdf56 100644 (file)
@@ -174,7 +174,7 @@ public:
 
 };
 
-/// a plet (bracket with) number
+/// a tuplet (bracket with) number
 class Plet_req : public Musical_span_req  {
 public:
   int plet_i_;
@@ -183,6 +183,13 @@ public:
   Plet_req ();
 };
 
+/// an extender line
+class Extender_req : public Musical_span_req  {
+public:
+  REQUESTMETHODS(Extender_req);
+  Extender_req ();
+};
+
 class Musical_script_req : public Musical_req,  public Script_req {
 public:
   REQUESTMETHODS(Musical_script_req);
index 8024bb552ee63669fef34434cc8d70a20acec684..4e82dc909e19c1bdbd5fb6123ac047ae371b7d43 100644 (file)
@@ -39,6 +39,7 @@ public:
   int abbrev_beam_type_i_;
   int default_abbrev_i_;
   Duration default_duration_;
+  Extender_req* extender_req;
   Plet plet_;
   Scope *default_header_p_;
     
index b61c4c197553e7824110a8775b832bb9a9faeee2..551cf48aec682c7a4f755e35fae5912a76c05bf6 100644 (file)
@@ -93,6 +93,7 @@ LYRICS                ({AA}|{TEX})[^0-9 \t\n\f]*
 ESCAPED                [nt\\'"]
 PLET           \\\[
 TELP           \\\]
+EXTENDER       [_][_]
 
 %%
 
@@ -262,6 +263,8 @@ TELP                \\\]
        {LYRICS} {
                /* ugr. This sux. */
                String s (YYText ()); 
+               if (s == "__")
+                       return yylval.i = EXTENDER;
                int i = 0;
                        while ((i=s.index_i ("_")) != -1) // change word binding "_" to " "
                        *(s.ch_l () + i) = ' ';
@@ -286,6 +289,8 @@ TELP                \\\]
          yyterminate (); // can't move this, since it actually rets a YY_NULL
        }
 }
+
+
 {WORD} {
        return scan_bare_word (YYText ());
 }
index 35d9774c14eb38a363c3121057d29069db3e126a..63259a3cc7b9eb0b62726184070973f18eff8bed 100644 (file)
@@ -203,6 +203,18 @@ Lookup::dynamic (String st) const
   return (*symtables_p_) ("dynamics")->lookup (st);
 }
 
+Atom
+Lookup::extender (Real width) const
+{
+  Atom a = (*symtables_p_) ("param")->lookup ("extender");
+  Array<Real> arr;
+  arr.push (width);
+  a.lambda_ = (lambda_scm (a.str_, arr));
+  a.str_ = "extender";
+  a.font_ = font_;
+  return a;
+}
+
 Atom
 Lookup::fill (Box b) const
 {
index e02877ad31d183a0d932ba40feeaf3de2eaf147f..07582ead8cc262919cdce83e767914992910902e 100644 (file)
@@ -263,6 +263,17 @@ Plet_req::do_print () const
 {
 }
 
+IMPLEMENT_IS_TYPE_B1 (Extender_req,Span_req);
+
+Extender_req::Extender_req ()
+{
+}
+
+void
+Extender_req::do_print () const
+{
+}
+
 
 bool
 Span_req::do_equal_b (Request*r) const
index bbe54c7ec6e5bc96f3a3e2d03d528c2640c2130d..61c1cd028c64b7d704c73a327394dc4d0c843afa 100644 (file)
@@ -31,6 +31,7 @@ static Keyword_ent the_key_tab[]={
   {"cm", CM_T},
   {"consists", CONSISTS},
   {"duration", DURATION},
+//  {"_", EXTENDER},
   {"font", FONT},
   {"grouping", GROUPING},
   {"header", HEADER},
index a024f0dd681f58d2dba7c83d3adb8d8c4d9f4ba7..86270bf7c38fc8b368f448da97e6a9c9ecb134cd 100644 (file)
@@ -29,6 +29,7 @@ My_lily_parser::My_lily_parser (Sources * source_l)
   default_duration_.durlog_i_ = 2;
   default_abbrev_i_ = 0;
   error_level_i_ = 0;
+  extender_req = 0;
   fatal_error_i_ = 0;
   default_header_p_ =0;
 }
index e8779bce9dcc1f0c2106266ff04109661fce4df4..344abe68b2acccafb7a12273210f2b43168cfd24 100644 (file)
@@ -46,7 +46,7 @@
 
 // mmm
 Mudela_version oldest_version ("1.0.7");
-Mudela_version version ("1.0.8");
+Mudela_version version ("1.0.9");
 
 
 // needed for bison.simple's malloc() and free()
@@ -166,6 +166,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %token CONSISTS
 %token DURATION
 %token END
+%token EXTENDER
 %token FONT
 %token GROUPING
 %token HEADER
@@ -273,7 +274,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <request>        post_request structured_post_request
 %type <pair>   plet_fraction
 %type <request> command_req verbose_command_req
-%type <request>        script_req  dynamic_req
+%type <request>        script_req  dynamic_req extender_req
 %type <string> string
 %type <score>  score_block score_body
 %type <intarr> shape_array
@@ -973,6 +974,9 @@ post_request:
                a->type_i_ = $1;
                $$ = a;
        }
+       | extender_req {
+               $$ = $1;
+       }
        ;
 
 optional_modality:
@@ -1062,6 +1066,16 @@ explicit_duration:
        }
        ;
 
+extender_req:
+       EXTENDER {
+               if (!THIS->lexer_p_->lyric_state_b ())
+                       THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
+               Extender_req * e_p = new Extender_req;
+               e_p->spantype = Span_req::START;
+               $$ = e_p;
+               THIS->extender_req = e_p;
+       };
+
 dynamic_req:
        ABSDYNAMIC '{' unsigned '}'     {
                Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
@@ -1260,8 +1274,17 @@ script_dir:
 
 pre_requests:
        {
+               if (THIS->extender_req)
+                 {
+                   Extender_req * e_p = new Extender_req;
+                   e_p->spantype = Span_req::STOP;
+                   THIS->pre_reqs.push (e_p);
+                   THIS->extender_req = 0;
+                 }
+                       
        }
        | pre_requests open_request_parens {
+
                Array<Request*>& r = *THIS->get_parens_request ($2);
                for (int i = 0; i < r.size (); i++ )
                        r[i]->set_spot (THIS->here_input ());
index 0110e366527db44deaf23746d5bec65015411f3e..a70465726d6d1ae6354f66d2e556dd06edb17410 100644 (file)
@@ -125,7 +125,7 @@ $lyric_verse2 = \lyrics{
        \[/3 Mit4 der8 \] T\"o-4. ne8
        \[/3 s\"u-4 "\ss{}en"8 \] Kla-4. gen8
        Fleh-4. en8 \[/3 sie4 f\"ur8 \]
-       mich.2 _4
+       mich2 _4
        _4_ _ 
        _4_ _
 
@@ -159,7 +159,7 @@ $lyric_through = \lyrics{
        \[/3 Komm4 be-8 \] gl\"u4. cke8 |
        mich!2. |
        \[/3 Komm4 be-8 \] gl\"u4. cke8 |
-       mich!2. |
+       mich,2. __ |
        _2 be-4 |
        gl\"u-2. |
        cke2. |
@@ -444,11 +444,19 @@ $grand_staff = \type GrandStaff<
        % To get original, \transpose d'
        % \transpose a gives a' to d'' (for basses, who sing an octave down)
        <
-               { \notes \transpose a { \$vocal_staff } }
+% kjoet, but i like the original better -- jcn
+%              { \notes \transpose a { \$vocal_staff } }
+%              \$lyric_staff
+%              { \notes \transpose a { \$grand_staff } }
+               { \notes { \$vocal_staff } }
                \$lyric_staff
-               { \notes \transpose a { \$grand_staff } }
+               { \notes { \$grand_staff } }
        >
-       \paper { \translator { \OrchestralScoreContext }}
+       \paper { 
+%              \translator { \OrchestralScoreContext }
+%              \translator { \OrchestralPartStaffContext }
+               \translator { \HaraKiriStaffContext }
+       }
        \midi{
                \tempo 4 = 54;
        }
index 48b4bfb7b7f883b57b42d245ab448500a5a4f0fb..2641a26ab94a2eb634fa352945d2b12479b46050 100644 (file)
@@ -5,7 +5,7 @@
 
 /xoffset 30 def
 /yoffset 700 def
-/staffrulethickness 1 def
+/stafflinethickness 1 def
 /staffheight 20 def
 
 /placebox
        grestore
 } bind def
 
+/extender % width
+{
+       gsave
+       0 0 moveto
+       stafflinethickness 0.8 mul setlinewidth
+       0 lineto stroke
+       grestore
+} bind def
+
 /widthbar % height width
 {
        gsave
index 32e3d9bafa521ff1fd55a3ec28ef984868b3cdc3..68721567558b5478a8c0fc10e61d1f165a78e3c5 100644 (file)
@@ -46,7 +46,9 @@
    \def\filedef#1#2{%#1=command name, #2=file name 
            \openin\defin=#2\relax\def#1{} 
            \ifeof\defin
-                   \message{***************** CAN NOT OPEN #2 ********************}
+                   \message{***************************************}
+                   \message{lily-ps-defs.tex: can't open `#2'}
+                   \message{***************************************}
                    \end
            \fi 
            \loop\ifnot{\ifeof\defin}\read\defin to\tempfiledef
index 9066a06522ee4650952724aaeb4f7349e7255679..22ec06fd8f76ea6a9963b3cca50a40407130ffac 100644 (file)
 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
 \def\fatdoublebar#1{\hbox{\phantom{\repeatcolon\kern2\smallspace}\thickbar{#1}\kern\smallspace\thickbar{#1}}}
 
-
+\def\extender#1{\vrule width#1 height .8\stafflinethickness}
 
 % ugh
 % see e.g. input/test/beam-pos.ly