X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstream-event.cc;h=24a022b4c969ec2427953e503e9172568189c2b7;hb=cc949a9fd031c51e1106f47c138357c16d1e6c2e;hp=489e0e0906a2274999cfbd0a4ccd44383d70bdb3;hpb=4bb29573149a0ffa1f881c5e38a0fe68e9e76b67;p=lilypond.git diff --git a/lily/stream-event.cc b/lily/stream-event.cc index 489e0e0906..24a022b4c9 100644 --- a/lily/stream-event.cc +++ b/lily/stream-event.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2011 Erik Sandberg + Copyright (C) 2005--2014 Erik Sandberg LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,8 @@ #include "ly-smobs.icc" #include "context.hh" #include "input.hh" -#include "input.hh" +#include "music.hh" +#include "pitch.hh" /* TODO: Rename Stream_event -> Event */ @@ -31,11 +32,10 @@ Stream_event::Stream_event () { } -Stream_event::Stream_event (SCM event_class, SCM mutable_props) +Stream_event::Stream_event (SCM event_class, SCM immutable_props) : Prob (ly_symbol2scm ("Stream_event"), - scm_list_1 (scm_cons (ly_symbol2scm ("class"), event_class))) + scm_acons (ly_symbol2scm ("class"), event_class, immutable_props)) { - mutable_property_alist_ = mutable_props; } Stream_event::Stream_event (SCM class_name, Input *origin) @@ -69,13 +69,34 @@ bool Stream_event::internal_in_event_class (SCM class_name) { SCM cl = get_property ("class"); - cl = scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), cl); return scm_c_memq (class_name, cl) != SCM_BOOL_F; } MAKE_SCHEME_CALLBACK (Stream_event, undump, 1); MAKE_SCHEME_CALLBACK (Stream_event, dump, 1); +void +Stream_event::make_transposable () +{ + /* This is in preparation for transposing stuff + that may be defined in the immutable part */ + + for (SCM s = immutable_property_alist_; scm_is_pair (s); s = scm_cdr (s)) + { + SCM entry = scm_car (s); + SCM prop = scm_car (entry); + SCM val = scm_cdr (entry); + + if ((unsmob_pitch (val) + || (prop == ly_symbol2scm ("element") && unsmob_music (val)) + || (prop == ly_symbol2scm ("elements") && scm_is_pair (val)) + || (prop == ly_symbol2scm ("pitch-alist") && scm_is_pair (val))) + && scm_is_false (scm_assq (prop, mutable_property_alist_))) + mutable_property_alist_ + = scm_acons (prop, ly_music_deep_copy (val), mutable_property_alist_); + } +} + SCM Stream_event::dump (SCM self) {