--- /dev/null
+/*
+ local-key-reg.cc -- implement Local_key_engraver
+
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "musical-request.hh"
+#include "command-request.hh"
+#include "local-key-engraver.hh"
+#include "local-key-item.hh"
+#include "key-engraver.hh"
+#include "debug.hh"
+#include "key-item.hh"
+#include "tie.hh"
+#include "note-head.hh"
+#include "time-description.hh"
+#include "engraver-group.hh"
+
+
+Local_key_engraver::Local_key_engraver()
+{
+ key_C_ = 0;
+ key_item_p_ =0;
+}
+
+void
+Local_key_engraver::do_creation_processing ()
+{
+ /*
+ UGHGUHGUH.
+
+ Breaks if Key_engraver is removed from under us.
+ */
+ Translator * result =
+ daddy_grav_l()->get_simple_translator (Key_engraver::static_name());
+
+ if (!result)
+ {
+ warning (_ ("out of tune") + "! " + _ ("can't find") + " Key_engraver");
+ }
+ else
+ {
+ key_C_ = &((Key_engraver*)result->engraver_l ())->key_;
+ local_key_ = *key_C_;
+ }
+}
+
+void
+Local_key_engraver::process_acknowledged ()
+{
+ if (!key_item_p_ && mel_l_arr_.size())
+ {
+ for (int i=0; i < mel_l_arr_.size(); i++)
+ {
+ Item * support_l = support_l_arr_[i];
+ Note_req * note_l = mel_l_arr_[i];
+
+ if (tied_l_arr_.find_l (support_l) &&
+ !note_l->forceacc_b_)
+ continue;
+
+ if (!note_l->forceacc_b_
+ && local_key_.different_acc (note_l->pitch_))
+ continue;
+ if (!key_item_p_)
+ {
+ key_item_p_ = new Local_key_item;
+ announce_element (Score_element_info (key_item_p_, 0));
+ }
+ key_item_p_->add (note_l->pitch_);
+ key_item_p_->add_support (support_l);
+ local_key_.set (note_l->pitch_);
+ }
+
+ }
+}
+
+void
+Local_key_engraver::do_pre_move_processing()
+{
+ if (key_item_p_)
+ {
+ for (int i=0; i < support_l_arr_.size(); i++)
+ key_item_p_->add_support (support_l_arr_[i]);
+
+ typeset_element (key_item_p_);
+ key_item_p_ =0;
+ }
+
+ mel_l_arr_.clear();
+ tied_l_arr_.clear();
+ support_l_arr_.clear();
+ forced_l_arr_.clear();
+}
+
+void
+Local_key_engraver::acknowledge_element (Score_element_info info)
+{
+ Score_element * elem_l = info.elem_l_;
+ Item * item_l = elem_l->access_Item();
+
+ Note_req * note_l = (info.req_l_->access_Musical_req ())
+ ? info.req_l_->access_Musical_req ()->access_Note_req () : 0;
+
+ if (note_l && item_l && item_l->is_type_b (Note_head::static_name ()))
+ {
+ mel_l_arr_.push (note_l);
+ support_l_arr_.push (item_l);
+ }
+ else if (info.req_l_->access_Command_req ()
+ && info.req_l_->access_Command_req ()->access_Key_change_req () && key_C_)
+ {
+ local_key_ = *key_C_;
+ }
+ else if (elem_l->is_type_b (Tie::static_name ()))
+ {
+ Tie * tie_l = (Tie*)elem_l->access_Spanner ();
+ if (tie_l->same_pitch_b_)
+ tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
+ }
+}
+
+void
+Local_key_engraver::do_process_requests()
+{
+ Time_description const * time_C_ = get_staff_info().time_C_;
+ if (time_C_ && !time_C_->whole_in_measure_)
+ {
+ if (key_C_)
+ local_key_= *key_C_;
+ }
+}
+
+
+IMPLEMENT_IS_TYPE_B1(Local_key_engraver,Engraver);
+ADD_THIS_TRANSLATOR(Local_key_engraver);
--- /dev/null
+% allemande-urtext.ly
+% belongs together with -cello.ly and -alto.ly
+% (who is going to make a -violin.ly?)
+
+%{
+Well, there are still some scripts in this "urtext".
+But merging melodic and scripts doen't work too well yet (see alto_scripts).
+%}
+
+n = { \slurnormal }
+d = { \slurdotted }
+comma = "\\sethuge\\ \\ ,";
+
+allemande_a = \melodic \relative c {
+ \voiceone a'16 |
+ [a8 bes16()a] \onevoice
+ [g()f e()d][d()cis d()e][a,8 \d bes16()g] |
+ [f( a )d f,] [e8 cis']\voiceone[d8. e16]\onevoice[f g a bes!] |
+ %3
+ \voiceone[c8 \n d16()es]\onevoice[d()c bes()a][c()bes a()g][d'8. f,16] |
+ [e( g )bes d][c()bes a()g]\n[bes()a g()f]
+ <[f8. a> <f16 a]> |
+ % urg fix
+ [b \n f( e )d][e \d cis'( d )cis]\voiceone[d8.( )e16]\onevoice
+ \n[f( e d)e] |
+ %6
+ [d( c b )c][b( a gis)a][gis8-\prall fis16()e][e' c( a )g] |
+ \voiceone [e' a, f d] [d f d b]\onevoice
+ [gis( b e )gis] \d [b( d c )b] |
+ %8
+ \n[c( a f )e][d( f e )d][gis8.-\trill()a16]\d[b d e,()d] |
+ % urg
+ [c( e a)d]\voiceone [b8.-\trill a16] a8 s4 s8 \onevoice |
+ %10
+ [d,!16 gis( a b a gis fis )e] \voiceone [e8 f16()e]\onevoice
+ [d()c b()a] |
+ \voiceone[d8 e16()f]\onevoice\d[e()d c()b]
+ \voiceone[d'16()b c()a] \onevoice [e8 gis] |
+ [a,8. cis16][e g!( f! )e][f( a )d gis,] a8.
+ %13
+ e16 \voiceone [e8. f16] \onevoice
+ \n[g!()e f()a]\n[cis,( d )e bes][a8.-\trill()g16] |
+ [f a'(f)d][g \n b,()cis a'][g(f e)d][fis d()es c(] |
+ %15
+ [)bes g'(a, )g][fis a d c'][bes(fis)g bes][d()a bes()g] |
+ [es(d)es g][c()a bes()g]\d[d(c)d g]\n[bes()fis g()es] |
+ %17
+ \n[c(bes)c bes'][a(c)es g,]\voiceone[fis8-\trill\d g16()a]\onevoice
+ [d,8 es16()c] |
+ [bes(d )g bes,][d,8 fis']\voiceone[g8. a16]\onevoice[bes d g, f] |
+ %19
+ \voiceone[e8.-\trill()f16]\onevoice [g()e c()bes]
+ \n[a()f' g,()f][e g'( a )bes] |
+ % :-(
+ % [bes( a g )f^\comma]
+ [bes( a g )f^"\\sethuge{\\ \\ '}"]
+ [a()e f()d][bes d(f)a][d()a bes()g] |
+ %21
+ [a,(\n)g'(\n cis())d][e()g, a()e][f()d bes()d]\d[gis, f'(e)d] |
+ % \n[d( cis b )a^\comma][c(a)fis d'][c a( b )d]
+ \n[d( cis b )a^"\\sethuge\\ \\ ,"]
+ [c(a)fis d'][c a( b )d]
+ [f!(d )gis, d'] |
+ %23
+ [cis(e g!)bes][e()a, bes()g][f()cis d()gis,][a8 cis!] |
+ % knee
+ \stemup [d,16 \stemboth d''(c!)a][bes!(g)e cis'][d a f d] d,8.
+}
+
+allemande_b = \melodic \relative c {
+ \voicetwo
+ s16 |
+ % <d'8 g' f'> s8 s2. |
+ <f8 g, d> s8 s2. |
+ s2 <a,8. d,> s16 s4 |
+ <fis'8 a, d,> s8 s2. |
+ s1 |
+ %5
+ s2 d8. s16 s4 |
+ s1 |
+ f!16 s16*3 b, s16*3 s2 |
+ s1 |
+ s4 e [dis8 ~ dis32 e( fis gis][a b c d! c b c )a] |
+ %10
+ s2 <a8 c,> s8 s4 |
+ <b8 gis,> s8 s4 <e,8 a,> s8 s4 |
+ s1 |
+ <cis'8 g,> s8 s2. |
+ %15
+ s1*3 |
+ s2 c,8 s8 s4 |
+ s2 g8. s16 s4 |
+ bes8.
+}
+
+allemande = \type Staff \melodic<
+ \$allemande_a
+ \$allemande_b
+>
+
--- /dev/null
+% menuetto-urtext.ly
+% belongs together with -cello.ly and -alto.ly
+% (who is going to make a -violin.ly?)
+
+%{
+Well, there are still some scripts in this "urtext".
+But merging melodic and scripts doen't work too well yet (see alto_scripts).
+%}
+
+menuetto_i_a = \melodic \relative c {
+ <d2\f f a> bes'4 |
+ [bes8 a bes g] a4 |
+ <d,4 bes> g [f8 e] |
+ [f8( e )d cis b a] |
+ <d2 f a> bes'!4 |
+ [bes8 a bes g] c!4 |
+ %7
+ <a f> <d f, bes,> <e g, g,> |
+ <cis2. e, a,> |
+ <a2\f e'> [d8( e16 )f] |
+ \slurdotted
+ [e8( d cis )e a,()g] |
+ a4 ~ d cis |
+ [g'8( f e )f d() c] |
+ %13
+ bes2 c4 |
+ [a8 g a f] <d'4 e, bes> |
+ <c f, a,> [bes8 a g a] |
+ [f8( e )f a g bes] |
+ <a2^\trill fis> bes4 |
+ [c8 bes c a] fis4^\trill |
+ %19
+% dispute
+% <bes,4 g' d'> <c, g' c> <[d,8 bes'(> )a] |
+ <d'4 g, bes,> <c g c,> [bes8()a] |
+ [c8( bes a )bes g()bes] |
+ d4 ~ cis d |
+ [g,8 f g e] f4 |
+ [g,8 g'] <{e4.^\trill ~ d8 } a4.> |
+ <d2. a d,> |
+}
+
+menuetto_i_b = \melodic \relative c {
+ \slurdotted
+ \skip 2.*1; |
+ <e8 c> \skip 8*5; |
+ \skip 2.*1; |
+ a,8 \skip 8*5; |
+ \skip 2.*1; |
+ e'8 \skip 8*5; |
+ \onevoice
+ \skip 2.*3; |
+ g8 \skip 8*5; |
+ f2 e4
+ d8 \skip 8*5; |
+ g4 ~ f e
+ f8 \skip 8*5; |
+ \skip 2.*3; |
+ es8 \skip 8*3; d4 |
+ \skip 4*2; d4 |
+ <d8 g,> \skip 8*5; |
+% dispute
+% g2 f4 |
+ g4 \skip 4*1; f4 |
+ cis8 \skip 8*3; d4 |
+}
+
+% UGH, fix this like in sarabande
+menuetto_i_a_voice_urg = \melodic{
+ \skip 2.*1; \voiceone
+ \skip 2.*1; \onevoice
+ \skip 2.*1; \voiceone
+ \skip 2.*1; \onevoice
+ \skip 2.*1; \voiceone
+ \skip 2.*1; \onevoice
+ \skip 2.*3; \voiceone
+ \skip 2.*1; \voiceone
+ \skip 2.*3;
+ \skip 4*2; \onevoice
+ \skip 4*2; \voiceone
+ \skip2.*1; \voiceone
+ \skip 4*2; \onevoice
+ \skip2.*1; \voiceone
+ \skip 2.*1; \onevoice
+ \skip 2*1; \voiceone
+ \skip 4*1;
+ \skip 2.*4; \onevoice
+ \skip 2.*1;
+% \bar "|.";
+}
+
+menuetto_i_a_voice_urg_urg = \melodic<
+ \$menuetto_i_a_voice_urg
+ \$menuetto_i_a
+>
+
+menuetto_i_b_voice_urg = \melodic{
+ \voicetwo
+ % urg urg, huh?
+ \skip 2.*8; \voicetwo
+}
+
+menuetto_i_b_voice_urg_urg = \melodic<
+ \$menuetto_i_b_voice_urg
+ \$menuetto_i_b
+>
+
+menuetto_i = \type Staff \melodic<
+ { \$menuetto_i_a_voice_urg_urg }
+ { \$menuetto_i_b_voice_urg_urg }
+>
+
+menuetto_ii = \melodic \relative c {
+ \slurdotted
+ fis4^\trill [d8( e fis )g] |
+ a4 fis, a' |
+ [g,8()b] e4 g |
+ \slurnormal
+ [d8( cis )b cis a g] |
+ % ugh, forcing knee
+ % Lily's not yet smart enough to decide for herself.
+ \stemup [fis \stemboth d''( cis b a )g] |
+ [b( a g fis e )d] |
+ %7
+ [cis d] g4 [fis8( g16 )a] |
+ <\stemdown a,2. \stemup e'> |
+ \stemboth
+ cis4^\prall [e8( d cis )b] |
+ cis4 g, cis' |
+ [fis,8()a] d4 fis |
+ [b,8()a g()fis \slurdotted g()b] |
+ \slurnormal
+ %13
+ [e, d'( cis )b cis()ais] |
+ % check slur! [d, b' a! g fis )e] |
+ [d,( b' a! g fis )e] |
+ [g( fis e d cis )d] |
+ [b( cis d e fis )g] |
+ [a( g fis g a )b] |
+ c4 dis,, c'' |
+ %19
+ [b8()a c( b a )g] |
+ [fis() g a()fis g()e] |
+ \slurdotted
+ cis4^\trill [a8( b cis )d] |
+ \slurnormal
+ [e( fis g )b] a4 |
+ [g8()fis e()d e()cis] |
+ d2.
+}
+