-*-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
.* 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.)
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
--- /dev/null
+
+\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 }
+ }
+ >
+ }
+}
--- /dev/null
+
+\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
+ }
+
+ >
+
+}
--- /dev/null
+/*
+ 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;
+}
--- /dev/null
+
+/*
+ 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;
+}
--- /dev/null
+/*
+ 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 */
--- /dev/null
+/*
+ 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 */
+
class Pitch_squash_engraver : public Engraver {
public:
-
VIRTUAL_COPY_CONS (Translator);
virtual void acknowledge_element (Score_element_info);
-
};
#endif /* PITCH_SQUASH_GRAV_HH */
#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
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))
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))
#include "input.hh"
static Keyword_ent the_key_tab[]={
+ {"autochange", AUTOCHANGE},
{"spanrequest", SPANREQUEST},
{"simultaneous", SIMULTANEOUS},
{"sequential", SEQUENTIAL},
{
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;
}
#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");
%pure_parser
/* tokens which are not keywords */
-
+%token AUTOCHANGE
%token TEXTSCRIPT
%token ACCEPTS
%token ALTERNATIVE
$$ = 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);
}