]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.2.11
authorfred <fred>
Tue, 26 Mar 2002 22:26:59 +0000 (22:26 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:26:59 +0000 (22:26 +0000)
13 files changed:
TODO
VERSION
input/bugs/ps.ly [new file with mode: 0644]
input/test/auto-change.ly [new file with mode: 0644]
lily/auto-change-iterator.cc [new file with mode: 0644]
lily/auto-change-music.cc [new file with mode: 0644]
lily/include/auto-change-iterator.hh [new file with mode: 0644]
lily/include/auto-change-music.hh [new file with mode: 0644]
lily/include/pitch-squash-engraver.hh
lily/music-iterator.cc
lily/my-lily-lexer.cc
lily/note-heads-engraver.cc
lily/parser.yy

diff --git a/TODO b/TODO
index 694d39e90e7c40734549c13c3952fd42b72665f7..9d0fd5f962fb414cf5d68f8715fbeac94770c601 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,6 @@
 -*-outline-layout:(2 (-1 -1 0 :) 0);outline-stylish-prefixes:nil -*-
 
+
 * GNU LilyPond TODO
 Features you cannot find in the documentation as working, should be
 mentioned here.  This is an assorted collection of stuff that will be
@@ -10,6 +11,9 @@ Grep -i for TODO, FIXME and ugh/ugr/urg.
 
 .* TODO
 . * use Rhythmic_head::position_i () for all Staff_referenced 
+. * setting indent to 0 with \shape fails
+. * junk -M ?
+. * mudela-book doco
 . * Depracate Wordwrap
 . * rerun profile
 . * Break_req handling is silly (break_forbid () + \break fucks up.)
diff --git a/VERSION b/VERSION
index 41c1aa8efa7ae9eb4af70e4310953bc4fbe5f1c0..ae415ac44e48cd57e3fde356c026586ce90fb3f7 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=2
-PATCH_LEVEL=10
+PATCH_LEVEL=11
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff --git a/input/bugs/ps.ly b/input/bugs/ps.ly
new file mode 100644 (file)
index 0000000..db59c5c
--- /dev/null
@@ -0,0 +1,19 @@
+
+\score {
+  {
+    \context Staff = i {
+      \notes { a' b' c' d' }
+    }
+
+%    \break
+
+    \context PianoStaff <
+      \context Staff = i {
+        \notes { a' b' c' d' }
+      }
+      \context Staff = ii {
+        \notes { \clef "bass"; a b c d }
+      }
+    >
+  }
+}
diff --git a/input/test/auto-change.ly b/input/test/auto-change.ly
new file mode 100644 (file)
index 0000000..3a27cbe
--- /dev/null
@@ -0,0 +1,14 @@
+
+\score {
+       \notes \context PianoStaff <
+       \context Staff = "up" {
+               \autochange Staff \relative c' { g4 a  b c d e f g }
+       }
+       \context Staff = "down" {
+               \clef bass; 
+               s1*2
+       }
+
+       >
+       
+}
diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc
new file mode 100644 (file)
index 0000000..5d3537b
--- /dev/null
@@ -0,0 +1,95 @@
+/*   
+  auto-change-iterator.cc -- implement  Auto_change_iterator
+
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "auto-change-music.hh"
+#include "auto-change-iterator.hh"
+#include "translator-group.hh"
+#include "musical-request.hh"
+
+
+
+void
+Auto_change_iterator::change_to (Music_iterator *it, String to_type,
+                                String to_id)
+{
+  Translator_group * current = it->report_to_l ();
+  Translator_group * last = 0;
+
+  /*
+    Cut & Paste from Change_iterator (ugh).
+
+    TODO: abstract this function 
+   */
+  
+  /* find the type  of translator that we're changing.
+     
+     If \translator Staff = bass, then look for Staff = *
+   */
+  while  (current && current->type_str_ != to_type)
+    {
+      last = current;
+      current = current->daddy_trans_l_;
+    }
+
+  if (current && current->id_str_ == to_id)
+    {
+      String msg;
+      msg += _ ("Can't switch translators, I'm there already");
+    }
+  
+  if (current) 
+    if (last)
+      {
+       Translator_group * dest = 
+         it->report_to_l ()->find_create_translator_l (to_type, to_id);
+       current->remove_translator_p (last);
+       dest->add_translator (last);
+      }
+    else
+      {
+       /*
+         We could change the current translator's id, but that would make 
+         errors hard to catch
+         
+          last->translator_id_str_  = change_l ()->change_to_id_str_;
+       */
+       //      error (_ ("I'm one myself"));
+      }
+  else
+    ; //    error (_ ("none of these in my family"));
+
+}
+
+void
+Auto_change_iterator::do_process_and_next (Moment m)
+{
+  Music_wrapper_iterator::do_process_and_next (m);
+  Pitch_interrogate_req spanish_inquisition;
+
+  Music_iterator *it = try_music (&spanish_inquisition);
+
+  if (it && spanish_inquisition.pitch_arr_.size ())
+    {
+      Musical_pitch p = spanish_inquisition.pitch_arr_[0];
+      Direction s = Direction (sign(p.semitone_pitch ()));
+      if (s && s != where_dir_)
+       {
+         where_dir_ = s;
+         String to_id =  (s > 0) ?  "up" : "down";
+         Auto_change_music const * auto_mus = dynamic_cast<Auto_change_music const* > (music_l_);
+
+         change_to (it, auto_mus->what_str_, to_id);     
+       }
+    }
+}
+
+Auto_change_iterator::Auto_change_iterator( )
+{
+  where_dir_ = CENTER;
+}
diff --git a/lily/auto-change-music.cc b/lily/auto-change-music.cc
new file mode 100644 (file)
index 0000000..7902d55
--- /dev/null
@@ -0,0 +1,17 @@
+
+/*   
+  auto-switch-music.cc --  implement 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "auto-change-music.hh"
+
+Auto_change_music::Auto_change_music (String what, Music * m)
+  : Music_wrapper (m)
+{
+  what_str_ = what;
+}
diff --git a/lily/include/auto-change-iterator.hh b/lily/include/auto-change-iterator.hh
new file mode 100644 (file)
index 0000000..4171a9c
--- /dev/null
@@ -0,0 +1,27 @@
+/*   
+  auto-change-iterator.hh -- declare Auto_change_iterator
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef AUTO_CHANGE_ITERATOR_HH
+#define AUTO_CHANGE_ITERATOR_HH
+
+#include "music-wrapper-iterator.hh"
+#include "direction.hh"
+
+class Auto_change_iterator  : public Music_wrapper_iterator
+{
+  Direction where_dir_;
+
+  void change_to (Music_iterator* , String, String);
+protected:
+  virtual void do_process_and_next (Moment);  
+public:
+  Auto_change_iterator ();
+};
+
+#endif /* AUTO_CHANGE_ITERATOR_HH */
diff --git a/lily/include/auto-change-music.hh b/lily/include/auto-change-music.hh
new file mode 100644 (file)
index 0000000..ec698be
--- /dev/null
@@ -0,0 +1,24 @@
+/*   
+  auto-change-music.hh -- declare Auto_change_music
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef AUTO_CHANGE_MUSIC_HH
+#define AUTO_CHANGE_MUSIC_HH
+
+#include "music-wrapper.hh"
+
+class Auto_change_music : public Music_wrapper
+{
+public:
+  Auto_change_music (String what, Music *);
+  String what_str_;
+};
+
+
+#endif /* AUTO_CHANGE_MUSIC_HH */
+
index ad042e84f370e6d37372d49ee0a825bfcf29069c..bc1b7be97b7ecfe0aa06cbf589bf995f27297259 100644 (file)
 
 class Pitch_squash_engraver : public Engraver {
 public:
-  
   VIRTUAL_COPY_CONS (Translator);
   virtual void acknowledge_element (Score_element_info);
-  
 };
 
 #endif /* PITCH_SQUASH_GRAV_HH */
index e677118a199f9e81edd4ca59e5c51c2040e3ae43..f9625b848b20952054a6e6cab6489756fab8fe85 100644 (file)
@@ -28,6 +28,8 @@
 #include "grace-music.hh"
 #include "lyric-combine-music.hh"
 #include "lyric-combine-music-iterator.hh"
+#include "auto-change-music.hh"
+#include "auto-change-iterator.hh"
 
 void
 Music_iterator::do_print() const
@@ -115,7 +117,9 @@ Music_iterator*
 Music_iterator::static_get_iterator_p (Music const *m)
 {
   Music_iterator * p =0;
-  
+
+  /* It would be nice to do this decentrally, but the order of this is
+     significant.  */
   if (dynamic_cast<Request_chord  const *> (m))
     p = new Request_chord_iterator;
   else if (dynamic_cast<Lyric_combine_music const*> (m))
@@ -131,7 +135,9 @@ Music_iterator::static_get_iterator_p (Music const *m)
   else if (dynamic_cast<Time_scaled_music  const *> (m))
     p = new Time_scaled_music_iterator;
   else if (dynamic_cast<Grace_music const*> (m))
-    p = new Grace_iterator;      
+    p = new Grace_iterator;
+  else if (dynamic_cast<Auto_change_music const*> (m))
+    p = new Auto_change_iterator;
   else if (dynamic_cast<Music_wrapper  const *> (m))
     p = new Music_wrapper_iterator;
   else if (Repeated_music const * n = dynamic_cast<Repeated_music const *> (m))
index 6edf314018aa063cd68841721b58a6cecf4be9c4..deb6ff27891c50d2a015595ca806a1f2dbae0983 100644 (file)
@@ -21,6 +21,7 @@
 #include "input.hh"
 
 static Keyword_ent the_key_tab[]={
+  {"autochange", AUTOCHANGE},
   {"spanrequest", SPANREQUEST},
   {"simultaneous", SIMULTANEOUS},
   {"sequential", SEQUENTIAL},
index 5243ff56cd77771a7e33626bde5e2eea255e9e1f..7ac5c8ade663bf416ba3878f7fa456595de15460 100644 (file)
@@ -33,6 +33,12 @@ Note_heads_engraver::do_try_music (Music *m)
     {
       return notes_end_pq_.size ();
     }
+  else if (Pitch_interrogate_req *p = dynamic_cast<Pitch_interrogate_req*> (m))
+    {
+      for (int i= note_req_l_arr_.size (); i--;)
+       p->pitch_arr_.push (note_req_l_arr_[i]->pitch_); // GUH UGH UGHUGH.
+      return true;
+    }
   return false;
   
 }
index c848282874dfafb619af43937c51326a7af2a3ee..feb3ae516ee5759604babdb716a40d984e357c21 100644 (file)
@@ -43,6 +43,7 @@
 #include "repeated-music.hh"
 #include "mudela-version.hh"
 #include "grace-music.hh"
+#include "auto-change-music.hh"
 
 // mmm
 Mudela_version oldest_version ("1.1.52");
@@ -124,7 +125,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %pure_parser
 
 /* tokens which are not keywords */
-
+%token AUTOCHANGE
 %token TEXTSCRIPT
 %token ACCEPTS
 %token ALTERNATIVE
@@ -785,6 +786,12 @@ Composite_music:
 
                $$ = csm;
        }
+       | AUTOCHANGE STRING Music       {
+               Auto_change_music * chm = new Auto_change_music (*$2, $3);
+               delete $2;
+               $$ = chm;
+               chm->set_spot ($3->spot ());
+       }
        | GRACE Music {
                $$ = new Grace_music ($2);
        }