]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/test/slur-shape.ly (x): remove file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 6 Jan 2004 23:34:27 +0000 (23:34 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 6 Jan 2004 23:34:27 +0000 (23:34 +0000)
* lily/translator-group.cc (apply_property_operations): new function.

24 files changed:
ChangeLog
Documentation/topdocs/NEWS.texi
input/regression/between-systems.ly
input/regression/clefs.ly
input/regression/staff-tweak.ly
input/test/slur-shape.ly [deleted file]
input/test/staff-lines.ly
input/test/staff-size.ly
lily/auto-change-iterator.cc
lily/change-iterator.cc
lily/context-specced-music-iterator.cc
lily/include/translator-def.hh
lily/include/translator-group.hh
lily/my-lily-lexer.cc
lily/parser.yy
lily/part-combine-music-iterator.cc
lily/score-engraver.cc
lily/score-performer.cc
lily/simultaneous-music-iterator.cc
lily/translator-def.cc
lily/translator-group.cc
scm/define-music-properties.scm
scm/define-translator-properties.scm
scm/font.scm

index 37762c395c86bab2baafb74d58c6fb1cd4de6ca5..8374433d5139385c50c6761398b5d1aee1dcaf76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
+2004-01-07  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * input/test/slur-shape.ly (x): remove file.
+
+       * lily/translator-group.cc (apply_property_operations): new function.
+
 2004-01-06  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/parser.yy (optional_prop_ops): allow \with {
+       PROPERTYSETTINGS } following \context or \new.
+
+       * lily/my-lily-lexer.cc: add \with.
+
+       * lily/parser.yy (property_operation): clean up definition of
+       property operations.
+       (property_op_to_music): new function.
+       (context_spec_music): new function
+
+       * VERSION: 2.1.7 released.
+       
        * input/regression/collision-merge-dots.ly: new file.
 
        * lily/note-collision.cc (check_meshing_chords): if merging heads,
index 887a273939a7bce36369ad14b90fe13fb04b8198..69cade5933b574a60461cfdf6cf704c65bbcecbf 100644 (file)
@@ -8,6 +8,20 @@
 @chapter New features in 2.1 since 2.0
 
 @itemize
+@item  Features of spanner contexts, like Staff, can now be changed easily:
+
+@example
+  \new Staff \with {
+     StaffSymbol \set #'line-count = #4
+  }
+        { c'4 }
+@end example
+
+@noindent
+puts a quarter note C on a staff with 4 lines.  
+
+
+
 @item Multi measure rests are now truly centered between the
 clefs/barlines of the staff, independent of symbols on the other staffs.
 
index 7d57707c377208b308d8c9054543c56a312ec867..cc763cb0d2443e1acfaaf31777a9e93d595a4aca 100644 (file)
@@ -11,15 +11,22 @@ of course.
 }
 
 
-% 
+#(define (set-page-break grob grob-c context)
+  (let*
+   ((meta (ly:get-grob-property grob 'meta))
+    (name (cdr (assoc 'name meta))))
+   
+   (if (equal? 'NonMusicalPaperColumn name)
+    (ly:set-grob-property! grob 'between-system-string "(pagebreak)\n\n"))
+))
 
 \score {
-\notes \relative c' { c1
-
-       \context Score \applyoutput #(outputproperty-compatibility (make-type-checker 'paper-column-interface) 'between-system-string "(pagebreak)\n\n")
+    \notes \relative c' {
+       c1
+       \context Score \applyoutput #set-page-break
        \break
-
-c1 }
-
+       
+       c1
+    }
 }
 
index f3ca6dbc012e8037ba698fc83b31a88d129764fb..b0b3687edf851ff81f67aaf78d32666c2224fc6d 100644 (file)
@@ -23,17 +23,11 @@ or below the clef respectively."
          \clef "varbaritone"c'1^"{varbaritone}" \bar "||"
          \clef "bass"c'1^"{bass}" \bar "||"
          \clef "subbass"c'1^"{subbass}" \bar "||"
-        \property Staff.Clef \override #'transparent = ##t
-         \clef "treble" c'1^"transparent=\#t" \bar "||"
-        \property Staff.Clef \override #'transparent = ##f
-        \context Staff \applyoutput  #(outputproperty-compatibility (make-type-checker 'clef-interface) 'full-size-change #t)
-         \clef "french" c'1^"full-size-change = \#t" \bar "|."
+        \property Staff.Clef \override #'full-size-change  = ##t 
+         \clef "treble" c'1^"full-size-change = \#t" \bar "|."
          }
          \paper{
-          \translator{
-            \StaffContext
-%           Clef \override #'full-size-change = ##t
-          }
+         raggedright = ##t
          }
 }
 
index d16c0c7baeef21d491bb43be9fee5f03a55c2a5d..16fa8a227eff50fa830da871e52d6677f4e70a03 100644 (file)
@@ -2,21 +2,23 @@
 \header {
 texidoc = "The staff is a grob, and may be adjusted as well: this one
  shows a staff with 6 thick line, and a slightly large staffspace.
-Beams remain correctly quantized.
-
-"    
+Beams remain correctly quantized."    
 }
 
-\score { \notes {
-    \property Score.StaffSymbol \set #'thickness = #2.0
-    \property Score.StaffSymbol \set #'line-count = #6
-    \property Score.StaffSymbol \set #'staff-space = #1.1
-    c'4 g'4 b'8  b'8  b'8  b'8  
-}
-        
-\paper  { raggedright = ##t
 
+mus = \notes \relative c' { c4 g' d'8 d d d }
 
-      } 
-     }
+\score {
+  \notes <<
+    \new Staff \mus
+    \new Staff \with { 
+       StaffSymbol \set #'thickness = #2.0
+       StaffSymbol \set #'line-count = #6
+       StaffSymbol \set #'staff-space = #1.1
+    } \mus
+  >>
+  \paper  {
+    raggedright = ##t
+  } 
+}
 
diff --git a/input/test/slur-shape.ly b/input/test/slur-shape.ly
deleted file mode 100644 (file)
index cca222d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#(ly:set-option 'old-relative)
-\version "1.9.8"
-\header {
-    texidoc = "Slurs become flatter as they grow longer. "
-
-}
-
-x = {
-  \applyoutput #(outputproperty-compatibility (make-type-checker 'note-head-interface) 
-                'extra-offset '(-1 . 0))
-}
-
-\score {
-    \context Staff \notes\relative c <<
-    \new Voice { \x f(f) }
-    \new Voice { \x g(s4g) }
-    \new Voice { \x a(s4*2a) }
-    \new Voice { \x b(s4*3b) }
-    \new Voice { \x c(s4*4c) }
-    \new Voice { \x d(s4*5d) }
-    \new Voice { \x e(s4*6e) }
-    \new Voice { \x f(s4*7f) }
-    \new Voice { \x g(s4*8g) }
-    \new Voice { \x a(s4*9a) }
-    \new Voice { \x b(s4*10b) }
-    \new Voice { \x c(s4*11c) }
-    \new Voice { \x d(s4*12d) }
-    \new Voice { \x e(s4*13e) }
-    \new Voice { \x f(s4*14f) }
-    \new Voice { \x g(s4*15g) }
-    \new Voice { \x a(s4*16a) }
-    \new Voice { \x b(s4*17b) }
-    \new Voice { \x c(s4*18c) }
-    \new Voice { \x d(s4*19d) }
-    \new Voice { \x e(s4*20e) }
-    \new Voice { \x f(s4*21f) }
-    \new Voice { \x g(s4*22g) }
-    \new Voice { \x a(s4*23a) }
-    \new Voice { \x b(s4*24b) }
-    \new Voice { \x c(s4*25c) }
-    \new Voice { \x d(s4*26d) }
-  >>
-  \paper {
-    raggedright = ##t
-    \translator{
-      \VoiceContext
-      Slur \override #'direction = #1
-      Stem \override #'direction = #-1
-    }
-  }
-}
-
index 406dd5c3bb603cafebed0da2f6d686494ed2a98c..6418038c0ca0d80c1acb83f431f941ccca3b8071 100644 (file)
@@ -2,30 +2,26 @@
 \version "1.9.8"
 
 \header { texidoc="@cindex Staff Lines
-Staff symbol property set workaround. "
+Set staff symbol property. "
 }
 
 
 upper = \notes\relative c'' {
-  c1-"x" d-"x" e-"x" f-"x"
+  c1 d e f
 }
 
 lower = \notes\relative c {
-  c1-"x" b-"x" a-"x" g-"x"
+  c1 b a g
 }
 
 \score {
   \context PianoStaff <<
-    %\time 4/4
     \new Staff <<
       \upper
     >>  
-    \new Staff <<
+    \new Staff \with { StaffSymbol \set #'line-count = #4 } <<
       \clef bass
       \lower
-      \applyoutput #(outputproperty-compatibility
-                    (make-type-checker 'staff-symbol-interface)
-                    'line-count  4)
     >>  
   >>
   \paper { raggedright=##t}  
index ca02169a75e4db24cb858dff3bee2e3ceea1763b..ffe5548d839e51785fc65a74008df4e743dfa10e 100644 (file)
@@ -1,36 +1,38 @@
 #(ly:set-option 'old-relative)
-\version "1.9.8"
+\version "2.1.6"
 
 \header { texidoc = "@cindex Staff Size
 
 Setting staff sizes is a little clumsy.  There are two options: using
 @code{StaffContainer} and override/revert, or
-@code{\applyoutput}. Both methods are shown in this example. "
+@code{\applyoutput}. Both methods are shown in this example."
 
 }
 
 \score {
-  \notes \relative c' << \new StaffContainer {
-     \property StaffContainer.StaffSymbol \set #'staff-space = #(/ 16 20)
-
-       \property Staff.fontSize = #-1
-       \property Voice.fontSize = #-1
+  \notes \relative c' <<
+      \new StaffContainer {
+         \property StaffContainer.StaffSymbol \set #'staff-space = #(/ (* magstep magstep))
+         \property Staff.fontSize = #-2
        
-       \dynamicUp\stemDown
-
-       %\key gis \major
-       c8 d  e[ f g a] b c \ff
-  }
-
-\new Staff \relative c'' { \dynamicDown c,,4 \ff c c c  }
-\new Staff {
-  \context Staff \applyoutput #(outputproperty-compatibility (make-type-checker 'staff-symbol-interface) 'staff-space 0.8)
-  \property Staff.fontSize = #-1
-  \clef bass
-  c8 c c c  c c c c
-}
->>
-\paper { raggedright = ##t}
+         \dynamicUp\stemDown
+         
+                               %\key gis \major
+         c8 d  e[ f g a] b c \ff
+      }
+
+      \new Staff \relative c'' {
+         \dynamicDown c,,4 \ff c c c
+      }
+      \new Staff \with {
+         fontSize = #-1
+         StaffSymbol \set #'staff-space = #(/ magstep)
+      } {
+         \clef bass
+         c8 c c c  c c c c
+      }
+  >>
+  \paper { raggedright = ##t}
 }
 
 
index 4bcb65314ea7a9801bd9db9bd17047f30f41a450..030e7444401d8f94cc1396e84c617a7290604983 100644 (file)
@@ -47,7 +47,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
     if (last)
       {
        Translator_group * dest = 
-         it->report_to ()->find_create_translator (to_type_sym, to_id);
+         it->report_to ()->find_create_translator (to_type_sym, to_id, SCM_EOL);
        current->remove_translator (last);
        dest->add_used_group_translator (last);
       }
index 7d458029c9177ef4c059f4f96cfe2dbae5293054..16e3f783a1cb831e043212b638aef603c40b9af5 100644 (file)
@@ -65,7 +65,7 @@ Change_iterator::process (Moment m)
     if (last)
       {
        Translator_group * dest = 
-         report_to ()->find_create_translator (to_type, to_id);
+         report_to ()->find_create_translator (to_type, to_id, SCM_EOL);
        current->remove_translator (last);
        dest->add_used_group_translator (last);
       }
index 15dc2ece077167d0c560c604208819e2bda208f5..c6751227bb90da0b3cef758d3d67cfb02a56a408 100644 (file)
@@ -28,9 +28,10 @@ Context_specced_music_iterator::construct_children ()
   SCM ci = get_music ()->get_mus_property ("context-id");
   if (gh_string_p (ci))
     c_id = ly_scm2string (ci);
+  SCM ops = get_music ()->get_mus_property ("property-operations");
   
   Translator_group* a
-    = report_to ()->find_create_translator (ct, c_id);
+    = report_to ()->find_create_translator (ct, c_id, ops);
 
   if (a)
     set_translator (a);
index 844bf8178c53c4b0dba9e96899b2047dcf4d8f2c..167cf28551a8f957dc09dd457a6659db4dd5f9d0 100644 (file)
@@ -46,10 +46,8 @@ public:
   void add_element (SCM name);
   void remove_element (SCM name);
   void add_last_element (SCM name);
+  void add_property_operation (SCM);
 
-  void add_push_property (SCM,SCM,SCM);
-  void add_pop_property (SCM,SCM);
-  void add_property_assign (SCM, SCM);
   Link_array<Translator_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
   Translator_group * instantiate (Music_output_def*);
 
@@ -58,7 +56,7 @@ public:
   static SCM make_scm () ;
 
   SCM clone_scm ()const;
-  void apply_property_operations (Translator_group*);
+  void apply_default_property_operations (Translator_group*);
 
 private:
   DECLARE_SMOBS (Translator_def,foo);
index 5a1fc1f6eabc97114f8419531f8d78a6c6e1adc2..b68f4b4ec29a40fae755d21a4e0f53269b7cc8de 100644 (file)
@@ -52,7 +52,7 @@ public:
   VIRTUAL_COPY_CONS (Translator);
   Translator_group (Translator_group const &);
   Translator_group ();
-  void add_fresh_group_translator (Translator *trans);
+  void add_fresh_group_translator (Translator *trans, SCM ops);
   void add_used_group_translator (Translator *trans);
   
   /// Score_register = 0, Staff_registers = 1, etc)
@@ -65,7 +65,7 @@ public:
   void check_removal ();
   // Translator *get_simple_translator (String) const;
   Translator_group *find_existing_translator (SCM context_name, String id);
-  Translator_group *find_create_translator (SCM context_name, String id);
+  Translator_group *find_create_translator (SCM context_name, String id, SCM ops);
   Link_array<Translator_group> path_to_acceptable_translator (SCM alias,
                                                              Music_output_def*) const;
   Translator_group*get_default_interpreter ();
@@ -84,6 +84,6 @@ public:
 
 
 bool melisma_busy (Translator* tr); // where to put this? --hwn
-
+void apply_property_operations (Translator_group*tg, SCM pre_init_ops);
 
 #endif // TRANSLATOR_GROUP_HH
index 07ab9374a63c0067188cc747a42984de1387348e..b631fe6be79fca52fd9974f8df5f76d8e0d4d943 100644 (file)
@@ -85,6 +85,7 @@ static Keyword_ent the_key_tab[]={
   {"transpose", TRANSPOSE},
   {"type", TYPE},
   {"unset", UNSET},
+  {"with", WITH},
   {0,0}
 };
 
index ef36c806ea1ef7b3266883d0c27659439aab7b01..4f267b9c70ead7ee60ed2cae9f2eca9a9cd4cde8 100644 (file)
@@ -84,6 +84,8 @@ TODO:
 
 #define MY_MAKE_MUSIC(x)  make_music_by_name (ly_symbol2scm (x))
 
+Music *property_op_to_music (SCM op);
+Music *context_spec_music (SCM type, SCM id, Music * m, SCM ops_);
 
 
 #define YYERROR_VERBOSE 1
@@ -300,7 +302,7 @@ yylex (YYSTYPE *s,  void * v)
 %token TRANSPOSE
 %token TYPE
 %token UNSET
-
+%token WITH
 
 /* escaped */
 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
@@ -313,6 +315,7 @@ yylex (YYSTYPE *s,  void * v)
 %type <i>      exclamations questions dots optional_rest
 %type <i>       bass_mod
 %type <scm>    grace_head
+%type <scm>    prop_ops_body optional_prop_ops
 %type <scm>    lyric_element
 %type <scm>    bass_number br_bass_figure bass_figure figure_list figure_spec
 %token <i>     DIGIT
@@ -377,8 +380,8 @@ yylex (YYSTYPE *s,  void * v)
 %type <scm>  embedded_scm scalar
 %type <music>  Music Sequential_music Simultaneous_music 
 %type <music>  relative_music re_rhythmed_music part_combined_music
-%type <music>  property_def translator_change  simple_property_def
-%type <scm> Music_list
+%type <music>  music_property_def translator_change 
+%type <scm> Music_list property_operation
 %type <outputdef>  music_output_def_body
 %type <music> shorthand_command_req
 %type <music>  post_event tagged_post_event
@@ -599,20 +602,8 @@ translator_spec_body:
        | translator_spec_body DESCRIPTION string  {
                unsmob_translator_def ($$)->description_ = $3;
        }
-       | translator_spec_body STRING '=' embedded_scm                  {
-               unsmob_translator_def ($$)->add_property_assign ($2, $4);
-       }
-       | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
-               unsmob_translator_def ($$)
-                       ->add_push_property (scm_string_to_symbol ($2), $4, $6);
-       }
-       | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
-               unsmob_translator_def ($$)
-                       ->add_push_property (scm_string_to_symbol ($2), $4, $6);
-       }
-       | translator_spec_body STRING REVERT embedded_scm  {
-         unsmob_translator_def ($$)->add_pop_property (
-               scm_string_to_symbol ($2), $4);
+       | translator_spec_body property_operation {
+               unsmob_translator_def ($$)->add_property_operation ($2);
        }
        | translator_spec_body NAME STRING  {
                unsmob_translator_def ($$)->type_name_ = scm_string_to_symbol ($3);
@@ -626,9 +617,14 @@ translator_spec_body:
        }
        | translator_spec_body GROBDESCRIPTIONS embedded_scm {
                Translator_def*td = unsmob_translator_def($$);
-               // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
-               for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
-                       td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
+
+               for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) {
+                       SCM tag = gh_caar (p);
+                       if (tag == ly_symbol2scm ("poppush"))
+                               tag = ly_symbol2scm ("push");
+                       td->add_property_operation (scm_list_n (ly_symbol2scm ("assign"),
+                                                       tag, ly_cdar (p), SCM_UNDEFINED));
+               }
        }
        | translator_spec_body CONSISTSEND STRING  {
                unsmob_translator_def ($$)->add_last_element ( $3);
@@ -915,7 +911,7 @@ Simple_music:
        | MUSIC_IDENTIFIER {
                $$ = unsmob_music ($1);
        }
-       | property_def
+       | music_property_def
        | translator_change
        ;
 
@@ -926,19 +922,25 @@ grace_head:
        | APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); }
        ;
 
-Composite_music:
-       CONTEXT STRING Music    {
-               Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
-
-               csm->set_mus_property ("element", $3->self_scm ());
-               scm_gc_unprotect_object ($3->self_scm ());
-
-               csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
-               csm->set_mus_property ("context-id", scm_makfrom0str (""));
+optional_prop_ops:
+       /* */ {
+               $$ = SCM_EOL;
+       }
+       | WITH '{' prop_ops_body '}' {
+               $$ = $3;
+       } 
+       ;
 
-               $$ = csm;
+prop_ops_body:
+       /* */  { $$ = SCM_EOL; }
+       | prop_ops_body property_operation  {
+                $$ = gh_cons ($2, $1);
        }
-       | AUTOCHANGE STRING Music       {
+       ;
+       
+
+Composite_music:
+       AUTOCHANGE STRING Music {
                Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
                chm->set_mus_property ("element", $3->self_scm ());
                chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc);
@@ -1000,33 +1002,21 @@ basic music objects too, since the meaning is different.
                scm_gc_unprotect_object ($2->self_scm ());
 #endif
        }
-       | CONTEXT string '=' string Music {
-               Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
-               csm->set_mus_property ("element", $5->self_scm ());
-               scm_gc_unprotect_object ($5->self_scm ());
+       | CONTEXT string '=' string optional_prop_ops Music {
+               $$ = context_spec_music ($2, $4, $6, $5);
 
-               csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
-               csm->set_mus_property ("context-id", $4);
-
-               $$ = csm;
        }
-       | NEWCONTEXT string Music {
+       | CONTEXT STRING optional_prop_ops Music        {
+               $$ = context_spec_music ($2, SCM_UNDEFINED, $4, $3);
+       }
+       | NEWCONTEXT string optional_prop_ops Music {
                static int new_context_count;
 
-               Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
-               csm->set_mus_property ("element", $3->self_scm ());
-               scm_gc_unprotect_object ($3->self_scm ());
-
-               csm->set_mus_property ("context-type", scm_string_to_symbol ($2));
-
                char s[1024];
                snprintf (s, 1024, "uniqueContext%d", new_context_count ++);
                
                SCM new_id = scm_makfrom0str (s);
-               csm->set_mus_property ("context-id", new_id);
-               $$ = csm;
+               $$ = context_spec_music ($2, new_id, $4, $3);
        }
        | TIMES {
                THIS->push_spot ();
@@ -1172,112 +1162,37 @@ translator_change:
        }
        ;
 
-property_def:
-       simple_property_def
-       | ONCE simple_property_def {
-               $$ = $2;
-               SCM e = $2->get_mus_property ("element");
-               unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
-       }
-       ;
-
-simple_property_def:
-       PROPERTY STRING '.' STRING '='  scalar {
-               Music *t = set_property_music (scm_string_to_symbol ($4), $6);
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
 
-               $$ = csm;
-               $$->set_spot (THIS->here_input ());
 
-               csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+property_operation:
+       STRING '='  scalar {
+               $$ = scm_list_n (ly_symbol2scm ("assign"),
+                       scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
        }
-       | PROPERTY STRING '.' STRING UNSET {
-               
-               Music *t = MY_MAKE_MUSIC("PropertyUnset");
-               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
-
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
-
-               $$ = csm;
-               $$->set_spot (THIS->here_input ());
-
-               csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+       | STRING UNSET {
+               $$ = scm_list_n (ly_symbol2scm ("unset"),
+                       scm_string_to_symbol ($1), SCM_UNDEFINED);
        }
-       | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
-               bool autobeam
-                 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
-               bool itc = internal_type_checking_global_b;
-               Music *t = MY_MAKE_MUSIC("OverrideProperty");
-               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
-               t->set_mus_property ("pop-first", SCM_BOOL_T);
-               if (autobeam)
-                       internal_type_checking_global_b = false;
-               t->set_mus_property ("grob-property", $6);
-               if (autobeam)
-                       internal_type_checking_global_b = itc;
-               t->set_mus_property ("grob-value", $8);
-
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
-               $$ = csm;
-               $$->set_spot (THIS->here_input ());
-
-               csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+       | STRING SET embedded_scm '=' embedded_scm {
+               $$ = scm_list_n (ly_symbol2scm ("poppush"),
+                       scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
        }
-       | PROPERTY STRING '.' STRING OVERRIDE
-               embedded_scm '=' embedded_scm
-       {
-               /*
-                       UGH UGH UGH UGH.
-               */
-               bool autobeam
-                 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
-               bool itc = internal_type_checking_global_b;
-
-               Music *t = MY_MAKE_MUSIC("OverrideProperty");
-               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
-               if (autobeam)
-                       internal_type_checking_global_b = false;
-               t->set_mus_property ("grob-property", $6);
-               t->set_mus_property ("grob-value", $8);
-               if (autobeam)
-                       internal_type_checking_global_b = itc;
-
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
-
-               $$ = csm;
-               $$->set_spot (THIS->here_input ());
-
-               csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
-
+       | STRING OVERRIDE embedded_scm '=' embedded_scm {
+               $$ = scm_list_n (ly_symbol2scm ("push"),
+                       scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
        }
-       | PROPERTY STRING '.' STRING REVERT embedded_scm {
-               Music *t = MY_MAKE_MUSIC("RevertProperty");
-
-               /*
-                       UGH.
-               */
-               bool autobeam
-                 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
-               bool itc = internal_type_checking_global_b;
+       | STRING REVERT embedded_scm {
+               $$ = scm_list_n (ly_symbol2scm ("pop"),
+                       scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
+       }
+       ;
 
-               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
-               if (autobeam)
-                       internal_type_checking_global_b = false;
-               t->set_mus_property ("grob-property", $6);
-               if (autobeam)
-                       internal_type_checking_global_b = itc;
-       
+music_property_def:
+       PROPERTY STRING '.' property_operation {
+               Music * t = property_op_to_music ($4);
                Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               csm->set_mus_property ("element", t->self_scm ());
+
+               csm->set_mus_property ("element", t->self_scm ());
                scm_gc_unprotect_object (t->self_scm ());
 
                $$ = csm;
@@ -1285,6 +1200,11 @@ simple_property_def:
 
                csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
        }
+       | ONCE music_property_def {
+               $$ = $2;
+               SCM e = $2->get_mus_property ("element");
+               unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
+       }
        ;
 
 
@@ -2447,3 +2367,71 @@ My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
 
        return -1;      
 }
+
+Music *
+property_op_to_music (SCM op)
+{
+       Music * m = 0;
+       SCM tag = gh_car (op);
+       SCM symbol  = gh_cadr (op);
+       SCM args = gh_cddr (op);
+       SCM grob_val = SCM_UNDEFINED;
+       SCM grob_sym = SCM_UNDEFINED;
+       SCM val = SCM_UNDEFINED;
+       
+       if (tag == ly_symbol2scm ("assign"))
+               {
+               m =  MY_MAKE_MUSIC("PropertySet");
+               val = gh_car (args);
+               }
+       else if (tag == ly_symbol2scm ("unset"))
+               m =  MY_MAKE_MUSIC("PropertyUnset");
+       else if (tag == ly_symbol2scm ("poppush")
+                || tag == ly_symbol2scm ("push"))
+               {
+               m  = MY_MAKE_MUSIC("OverrideProperty");
+               grob_sym = gh_car (args);
+               grob_val = gh_cadr (args);
+               }
+       else if (tag == ly_symbol2scm ("pop")) {
+               m = MY_MAKE_MUSIC("RevertProperty");
+               grob_sym = gh_car (args);
+               }
+
+       m->set_mus_property ("symbol", symbol);
+       if (val != SCM_UNDEFINED)
+               m->set_mus_property ("value", val);
+       if (grob_val != SCM_UNDEFINED)
+               m->set_mus_property ("grob-value", grob_val);
+
+       if (grob_sym != SCM_UNDEFINED)
+               {
+               bool itc = internal_type_checking_global_b;
+               bool autobeam = gh_equal_p (symbol, ly_symbol2scm ("autoBeamSettings"));
+               if (autobeam)
+                       internal_type_checking_global_b = false;
+               m->set_mus_property ("grob-property", grob_sym);
+               if (autobeam)
+                       internal_type_checking_global_b = itc;
+               }       
+       if (op == ly_symbol2scm ("poppush"))
+               m->set_mus_property ("pop-first", SCM_BOOL_T); 
+
+
+       return m;
+}
+
+Music*
+context_spec_music (SCM type, SCM id, Music * m, SCM ops)
+{
+       Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
+
+       csm->set_mus_property ("element", m->self_scm ());
+       scm_gc_unprotect_object (m->self_scm ());
+
+       csm->set_mus_property ("context-type", scm_string_to_symbol (type));
+       csm->set_mus_property ("property-operations", ops);
+       csm->set_mus_property ("context-id", id);
+       return csm;
+}
+       
index e9bdc0ec4278ae03953902aed02305824a660f9e..2445ab315d4213d6a7d381d0bdf1b54a5339d50f 100644 (file)
@@ -124,7 +124,7 @@ Part_combine_music_iterator::change_to (Music_iterator *it, SCM to_type,
     if (last)
       {
        Translator_group * dest = 
-         it->report_to ()->find_create_translator (to_type, to_id);
+         it->report_to ()->find_create_translator (to_type, to_id, SCM_EOL);
        current->remove_translator (last);
        dest->add_used_group_translator (last);
       }
@@ -172,7 +172,7 @@ Part_combine_music_iterator::get_state (Moment)
   SCM w = p->get_mus_property ("what");
     
   
-  Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_);
+  Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_, SCM_EOL);
 
   SCM s = first_translator->get_property ("changeMoment");
   if (!gh_pair_p (s))
@@ -399,8 +399,8 @@ s      Consider thread switching: threads "one", "two" and "both".
     change_to (second_iter_, w, (combine_b ? "one" : "two")
               + suffix_);
   
-  Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_);
-  Translator_group *second_translator = second_iter_->report_to ()->find_create_translator (w, "two" + suffix_);
+  Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_, SCM_EOL);
+  Translator_group *second_translator = second_iter_->report_to ()->find_create_translator (w, "two" + suffix_, SCM_EOL);
   
 
   /* Hmm */
index 94d5b6ae04c02a6f1ef09bc24a73783304e985fc..a6b5018b0c74e943b0a677d78ff6a88f83248cde 100644 (file)
@@ -102,7 +102,7 @@ Score_engraver::initialize ()
     error (_f ("can't find `%s'", "feta20.afm")
           + "\n" +_ ("Fonts have not been installed properly.  Aborting"));
    
-  unsmob_translator_def (definition_)->apply_property_operations (this);
+  unsmob_translator_def (definition_)->apply_default_property_operations (this);
 
   assert (dynamic_cast<Paper_def *> (output_def_));
   assert (!daddy_trans_);
index 0cb5d00a8bc449e5fadcad2a720e0a0cb32ade87..1c0af88cfca923c18dadcadbd53b1a979128c5ac 100644 (file)
@@ -112,7 +112,7 @@ Score_performer::get_output ()
 void
 Score_performer::initialize ()
 {
-  unsmob_translator_def (definition_)->apply_property_operations (this);
+  unsmob_translator_def (definition_)->apply_default_property_operations (this);
   assert (dynamic_cast<Midi_def *> (output_def_));
   performance_ = new Performance;
   performance_->midi_ = dynamic_cast<Midi_def*> (output_def_);
index 6a93ab7b0cc63b13f75cdc4434da6e6c00971486..c59cab4cae6267a577c77da08243661fd626ba5f 100644 (file)
@@ -79,7 +79,7 @@ Simultaneous_music_iterator::construct_children ()
 
       SCM name = unsmob_translator_def (report_to ()->definition_)->type_name_;
       Translator_group * t = (j && separate_contexts_b_)
-       ? report_to ()->find_create_translator (name, to_string (j))
+       ? report_to ()->find_create_translator (name, to_string (j), SCM_EOL)
        : report_to ();
 
       if (!t)
index 38457e2543d0ae6d2c93d56d38e7631daccd799d..3873850d01157d5fca67899af44f4630ccf418fa 100644 (file)
@@ -54,7 +54,6 @@ Translator_def::Translator_def ()
   description_ = SCM_EOL;
 
   smobify_self();
-  
 }
 
 Translator_def::~Translator_def ()
@@ -142,23 +141,15 @@ Translator_def::add_last_element (SCM s)
 {
   this->end_consists_name_list_ = modify_definition (this->end_consists_name_list_, s, true);
 }
-void
-Translator_def::add_push_property (SCM props, SCM syms,  SCM vals)
-{
-  this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("push"), props, syms, vals, SCM_UNDEFINED),
-                                this->property_ops_);
-}
 
 void
-Translator_def::add_pop_property (SCM props, SCM syms)
+Translator_def::add_property_operation (SCM what)
 {
-  this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("push"), props, syms, SCM_UNDEFINED),
-                                this->property_ops_);
+  this->property_ops_ = gh_cons (what, this->property_ops_);
 }
 
 
 
-
 Link_array<Translator_def>
 Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const
 {
@@ -176,7 +167,6 @@ Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* o
   Link_array<Translator_def> best_result;
   for (int i=0; i < accepteds.size (); i++)
     {
-
       /*
        don't check aliases, because \context Staff should not create RhythmicStaff.
       */
@@ -261,31 +251,13 @@ Translator_def::instantiate (Music_output_def* md)
   return tg;
 }
 
-
 void
-Translator_def::apply_property_operations (Translator_group*tg)
+Translator_def::apply_default_property_operations (Translator_group*tg)
 {
-  SCM correct_order = scm_reverse (property_ops_); // pity of the mem.
-  for (SCM s = correct_order; gh_pair_p (s); s = ly_cdr (s))
-    {
-      SCM entry = ly_car (s);
-      SCM type = ly_car (entry);
-      entry = ly_cdr (entry); 
-      
-      if (type == ly_symbol2scm ("push"))
-       {
-         SCM val = ly_cddr (entry);
-         val = gh_pair_p (val) ? ly_car (val) : SCM_UNDEFINED;
-
-         tg->execute_pushpop_property (ly_car (entry), ly_cadr (entry), val);
-       }
-      else if (type == ly_symbol2scm ("assign"))
-       {
-         tg->internal_set_property (ly_car (entry), ly_cadr (entry));
-       }
-    }
+  apply_property_operations (tg, property_ops_);
 }
 
+
 SCM
 Translator_def::clone_scm () const
 {
@@ -302,12 +274,6 @@ Translator_def::make_scm ()
   return t->self_scm();
 }
 
-void
-Translator_def::add_property_assign (SCM nm, SCM val)
-{
-  this->property_ops_ = gh_cons (scm_list_n (ly_symbol2scm ("assign"), scm_string_to_symbol (nm), val, SCM_UNDEFINED),
-                                this->property_ops_);
-}
 
 /*
   Default child context as a SCM string, or something else if there is
index b9b3b33dedca69e2b02b6c87b9442f79aa0f4935..aae7f5071ff59e22fe73cb4b8e8ae519ac7779b6 100644 (file)
@@ -86,15 +86,15 @@ Translator_group::add_used_group_translator (Translator *t)
 
 
 void
-Translator_group::add_fresh_group_translator (Translator*t)
+Translator_group::add_fresh_group_translator (Translator*t, SCM pre_init_ops)
 {
   Translator_group*tg = dynamic_cast<Translator_group*> (t);
   assert (tg);
 
   trans_group_list_ = add_translator (trans_group_list_,t); 
-  unsmob_translator_def (tg->definition_)->apply_property_operations (tg);
+  unsmob_translator_def (tg->definition_)->apply_default_property_operations (tg);
+  apply_property_operations (tg, pre_init_ops);
   t->initialize ();
-  
 }
 
 
@@ -123,7 +123,7 @@ Translator_group::find_existing_translator (SCM n, String id)
 
 
 Translator_group*
-Translator_group::find_create_translator (SCM n, String id)
+Translator_group::find_create_translator (SCM n, String id, SCM operations)
 {
   Translator_group * existing = find_existing_translator (n,id);
   if (existing)
@@ -141,9 +141,14 @@ Translator_group::find_create_translator (SCM n, String id)
        {
          Translator_group * new_group = path[i]->instantiate (output_def_);
 
+         SCM ops = SCM_EOL; 
          if (i == path.size () -1)
-           new_group->id_string_ = id;
-         current->add_fresh_group_translator (new_group);
+           {
+             new_group->id_string_ = id;
+             ops = operations;
+           }
+
+         current->add_fresh_group_translator (new_group, ops);
          current = new_group;
        }
 
@@ -152,7 +157,7 @@ Translator_group::find_create_translator (SCM n, String id)
 
   Translator_group *ret = 0;
   if (daddy_trans_)
-    ret = daddy_trans_->find_create_translator (n,id);
+    ret = daddy_trans_->find_create_translator (n, id, operations);
   else
     {
       warning (_f ("can't find or create `%s' called `%s'", ly_symbol2string (n).to_str0 (), id));
@@ -232,7 +237,7 @@ Translator_group::get_default_interpreter ()
          t = unsmob_translator_def (this->definition_);
        }
       Translator_group *tg = t->instantiate (output_def_);
-      add_fresh_group_translator (tg);
+      add_fresh_group_translator (tg, SCM_EOL);
 
       if (!tg->is_bottom_translator_b ())
        return tg->get_default_interpreter ();
@@ -467,3 +472,27 @@ Translator_group::context_name () const
   Translator_def * td = unsmob_translator_def (definition_ );
   return ly_symbol2string (td->type_name_);
 }
+
+void
+apply_property_operations (Translator_group*tg, SCM pre_init_ops)
+{
+  SCM correct_order = scm_reverse (pre_init_ops);
+  for (SCM s = correct_order; gh_pair_p (s); s = ly_cdr (s))
+    {
+      SCM entry = ly_car (s);
+      SCM type = ly_car (entry);
+      entry = ly_cdr (entry); 
+      
+      if (type == ly_symbol2scm ("push") || type == ly_symbol2scm ("poppush"))
+       {
+         SCM val = ly_cddr (entry);
+         val = gh_pair_p (val) ? ly_car (val) : SCM_UNDEFINED;
+
+         tg->execute_pushpop_property (ly_car (entry), ly_cadr (entry), val);
+       }
+      else if (type == ly_symbol2scm ("assign"))
+       {
+         tg->internal_set_property (ly_car (entry), ly_cadr (entry));
+       }
+    }
+}
index 705706a735a132ba2439354a762abde664a0d61a..5c75926ad05bba6bfd2590b34b1f610ce386dc37 100644 (file)
@@ -72,6 +72,8 @@ For chord inversions, this is negative.")
 (music-property-description 'pop-first boolean? "Do a revert before we try to do a override on some grob property.")
 (music-property-description 'procedure procedure?
                            "The function to run with \\applycontext. It must take a single argument, being the context.")
+(music-property-description 'property-operations list?
+                           "Do these operations for instantiating the context.")
 (music-property-description 'predicate procedure? "the predicate of a \outputproperty")
 (music-property-description 'type symbol? "The type of this music object. Determines iteration in some cases.")
 (music-property-description 'types list? "The types of this music object. Determines iteration in some cases.")
index 6f1342ae38b4e2a892d0b2aad1343fcbed9439e9..f40bb957edddd3581d4a9480432ead873121b209 100644 (file)
@@ -406,7 +406,7 @@ is erased.
 (translator-property-description 'stringTunings list? "The tablature strings tuning. Must be a list of the different semitons pitch of each string (starting by the lower one).")
 (translator-property-description 'subdivideBeams boolean? "If set, multiple beams will be subdivided at beat
 positions - by only drawing one beam over the beat.")
-(translator-property-description 'systemStartDelimiter symbol? "Which grob to make for the start of the system/staff?")
+(translator-property-description 'systemStartDelimiter symbol? "Which grob to make for the start of the system/staff? Set to @code{SystemStartBrace}, @code{SystemStartBracket} or @code{SystemStartBar}.")
 (translator-property-description 'tablatureFormat procedure?
                                 "Function formatting a tab notehead; it takes
 a string number, a list of string tunings and Pitch object. It returns the text as a string.")
index 0592c0110a13f1951d4785c625d31ed8bcd83a5c..afa6631f6dae4a27560147f7759045d20a486184 100644 (file)
@@ -29,6 +29,8 @@ or
 
 "
 
+(define-public magstep (exp (* (/ 1 6) (log 2))))
+
 
 (define-public paper20-font-vector
   '((#(medium upright number) .