]> git.donarmstrong.com Git - lilypond.git/commitdiff
(Changing context
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Mar 2004 15:17:52 +0000 (15:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Mar 2004 15:17:52 +0000 (15:17 +0000)
default settings): new node.
(Defining new  contexts): new node.

Documentation/user/changing-defaults.itely
lily/separating-line-group-engraver.cc
lily/text-engraver.cc
ly/engraver-init.ly
scm/define-context-properties.scm
scm/define-grobs.scm

index 2e9840019e66818e3da9aa2c7bb42f287a0bb0ea..eeb235954370b875698aeec774313c4b2cdd8f04 100644 (file)
@@ -267,7 +267,8 @@ Translation @arrow{} Context.
 * Changing context properties on the fly ::  
 * Modifying context plug-ins::  
 * Layout tunings within contexts::  
-* Defining context defaults ::  
+* Changing context default settings::  
+* Defining new  contexts::      
 * Which properties to change::  
 @end menu
 
@@ -669,7 +670,7 @@ The adjustments of the previous chapters can also be entered separate
 from the music, in the @code{\paper} block,
 
 @example
-  \paper {
+  \paper @{
      @dots{}
      \context @{
         \StaffContext
@@ -713,6 +714,11 @@ will also work.
 
 
 
+@refbugs
+
+It is not possible to collect changes in a variable, and apply them to
+one @code{\context} definition by referencing that variable.
+
 
 @node Defining new  contexts
 @subsection Defining new  contexts
@@ -732,7 +738,7 @@ to indicate improvisation in Jazz pieces,
     \name ImproVoice
     \type "Engraver_group_engraver"
     \consists "Note_heads_engraver"
-    \consists "Text_script_engraver"
+    \consists "Text_engraver"
     \consists Pitch_squash_engraver
     squashedPosition = #0
     \override NoteHead #'style = #'slash
@@ -741,12 +747,12 @@ to indicate improvisation in Jazz pieces,
   }
   \context { \StaffContext
     \accepts "ImproVoice"
-  }
+  }}
   \score { \notes \relative c'' {
-    a4 d8 bes8 \new ImproVoice { c4^"ad lib" 
+    a4 d8 bes8 \new ImproVoice { c4^"ad lib" 
      c4 c^"undress"  c c_"while playing :)"  } 
     a1 
-  }
+  }}
 @end lilypond
 
 
@@ -754,11 +760,11 @@ These settings are again done within a @code{\context} block inside a
 @code{\paper} block,
 
 @example
-  \paper  {
-    \context {
+  \paper @{
+    \context @{
       @dots{}
-    }
-  }
+    @}
+  @}
 @end example
 
 In the following discussion, the example input shown should go on the
@@ -783,7 +789,7 @@ The context will print notes, and instructive texts
 
 @verbatim
   \consists Note_heads_engraver
-  \consists Text_script_engraver
+  \consists Text_engraver
 @end verbatim
 
 but only on the center line,
@@ -830,8 +836,8 @@ Put together, we get
   }
 @end verbatim
 
-Contexts form hierarchies. We want to hang the @consists{ImproVoice}
-under @consists{Staff}, just like normal @code{Voice}s. Therefore, we
+Contexts form hierarchies. We want to hang the @context{ImproVoice}
+under @context{Staff}, just like normal @code{Voice}s. Therefore, we
 modify the @code{Staff} definition with the @code{\accepts}
 command,@footnote{The opposite of @code{\accepts} is @code{\denies},
 which is sometimes when reusing existing context definitions. }
@@ -846,8 +852,6 @@ which is sometimes when reusing existing context definitions. }
 @end verbatim 
 
 
-@example
-
 
     
 @node Which properties to change
@@ -1670,8 +1674,6 @@ This manual: @ref{Selecting font sizes}.
 @menu
 * Line breaking::               
 * Page layout::                 
-* Defining contexts::           
-* Defining new contexts::       
 @end menu
 
 @node Line breaking
@@ -1809,112 +1811,6 @@ reliably choose page breaks in longer pieces.
 
 
 
-@node Defining contexts
-@subsection Defining contexts
-
-@cindex context definition
-@cindex translator definition
-
-The most common way to create a new context definition is by extending
-an existing one.  An existing context from the paper block is copied
-by referencing a context identifier:
-
-@example
-\paper @{
-  \context @{
-    @var{context-identifier}
-  @}
-@}
-@end example
-
-@noindent
-Every predefined context has a standard identifier. For example, the
-@code{Staff} context can be referred to as @code{\StaffContext}.
-
-The context can then be modified by setting or changing properties,
-e.g.
-@example
-\context @{
-  \StaffContext
-  Stem \set #'thickness = #2.0
-  defaultBarType = #"||"
-@}
-@end example
-These assignments happen before interpretation starts, so a property
-command will override any predefined settings.
-
-@cindex engraver
-
-@refbugs
-
-It is not possible to collect multiple property assignments in a
-variable, and apply to one @code{\context} definition by
-referencing that variable.
-
-
-
-@node Defining new contexts
-@subsection Defining new contexts
-
-
-It is also possible to define new contexts from scratch.  To do this,
-you must define give the new context a name.  In the following
-example, a very simple Staff context is created: one that will put
-note heads on a staff symbol.
-
-@example
-\context @{
-  \type "Engraver_group_engraver"
-  \name "SimpleStaff"
-  \alias "Staff"
-  \consists "Staff_symbol_engraver"
-  \consists "Note_head_engraver"
-  \consistsend "Axis_group_engraver"
-@}
-@end example
-
-@noindent
-The argument of @code{\type} is the name for a special engraver that
-handles cooperation between simple engravers such as
-@code{Note_head_engraver} and @code{Staff_symbol_engraver}.  This
-should always be  @code{Engraver_group_engraver} (unless you are
-defining a Score context from scratch, in which case
-@code{Score_engraver}   must be used).
-
-The complete list of context  modifiers is the following:
-@itemize @bullet
-@item @code{\alias} @var{alternate-name}:
-This specifies a different name.  In the above example,
-@code{\set Staff.X = Y} will also work on @code{SimpleStaff}s.
-
-@item @code{\consistsend} @var{engravername}:
-Analogous to @code{\consists}, but makes sure that
-@var{engravername} is always added to the end of the list of
-engravers.
-
-Engravers that group context objects into axis groups or alignments
-need to be at the end of the list. @code{\consistsend} insures that
-engravers stay at the end even if a user adds or removes engravers.
-
-@item @code{\accepts} @var{contextname}:
-This context can contains @var{contextname} contexts.  The first
-@code{\accepts} is created as a default context when events (e.g. notes
-or rests) are encountered.
-
-@item @code{\denies}:
-The opposite of @code{\accepts}.
-
-@item @code{\name} @var{contextname}:
-This sets the type name of the context, e.g. @code{Staff},
-@code{Voice}.  If the name is not specified, the translator will not
-do anything.
-@end itemize
-
-@c EOF
-
-
-
-
 @node Output details
 @section Output details
 
index 93b3ccdda3420ae56f14a9573eb726f87b146fb5..80b446534b694254d98391a41ca4d1383bbefa46 100644 (file)
@@ -144,7 +144,8 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i)
        }
       announce_grob (p_ref_, SCM_EOL);
 
-      if (p_ref_ == break_item_)
+      if (to_boolean (get_property ("createSpacing"))
+         && p_ref_ == break_item_)
        {
          Item *it  = make_item ("StaffSpacing");
          current_spacings_.staff_spacing_ = it;
@@ -225,8 +226,8 @@ Separating_line_group_engraver::stop_translation_timestep ()
 
 ENTER_DESCRIPTION (Separating_line_group_engraver,
 /* descr */       "Generates objects for computing spacing parameters.",
-/* creats*/       "SeparationItem SeparatingGroupSpanner",
+/* creats*/       "SeparationItem SeparatingGroupSpanner StaffSpacing",
 /* accepts */     "",
 /* acks  */      "item-interface",
-/* reads */       "",
+/* reads */       "createSpacing",
 /* write */       "breakableSeparationItem");
index e87234978e2a9bc537c82cbd2583fe467df56ab5..09e1ab073c7102335cae5eee224d388799891fe2 100644 (file)
@@ -21,7 +21,7 @@
  */
 class Text_engraver : public Engraver
 {
-  Link_array<Music> reqs_;
+  Link_array<Music> evs_;
   Link_array<Item> texts_;
 public:
   TRANSLATOR_DECLARATIONS (Text_engraver);
@@ -37,7 +37,7 @@ Text_engraver::try_music (Music *m)
 {
   if (m->is_mus_type ("text-script-event"))
     {
-      reqs_.push (m);
+      evs_.push (m);
       return true;
     }
   return false;
@@ -79,9 +79,9 @@ Text_engraver::process_acknowledged_grobs ()
 {
   if (texts_.size ())
     return;
-  for (int i=0; i < reqs_.size (); i++)
+  for (int i=0; i < evs_.size (); i++)
     {
-      Music * r = reqs_[i];
+      Music * r = evs_[i];
       
       // URG: Text vs TextScript
       Item *text = make_item ("TextScript");
@@ -123,7 +123,7 @@ Text_engraver::stop_translation_timestep ()
       typeset_grob (ti);
     }
   texts_.clear ();
-  reqs_.clear ();
+  evs_.clear ();
 }
 
 
index 05fe54c1869198d85157d718eb322ed814b068c4..3dec9753f18a7e61c3cd511743d83606c602ad76 100644 (file)
@@ -47,7 +47,7 @@
        extraVerticalExtent = ##f
        verticalExtent = ##f 
        localKeySignature = #'()
-       
+       createSpacing = ##t
        % explicitly set instrument, so we don't get 
        % weird effects when doing instrument names for
        % piano staves
index c041e85cfeceb9bcf98f8534450e3ab9bb1222dd..b9894df096c13cfccf55f3695e8f6a4f7d5c503f 100644 (file)
@@ -143,6 +143,7 @@ symbol go, measured in half staff spaces from the center of the staff.")
      (connectArpeggios ,boolean? " If set, connect arpeggios across
 piano staff.")
      (createKeyOnClefChange ,boolean? "Print a key signature whenever the clef is changed.")
+     (createSpacing ,boolean? "Create StaffSpacing objects? Should be set for staves.")
      (crescendoText ,markup? "Text to print at start of non-hairpin crescendo, i.e.: @samp{cresc.}")
      (crescendoSpanner ,symbol? "Type of spanner to be used for crescendi.
 One of: @samp{hairpin}, @samp{line}, @samp{dashed-line},
index 683f28fc659ae6a37e40346e733d5f4339caf8a4..c987c97b0a738eda0514f301f60bbb7c2296e9c8 100644 (file)
      . (
        (breakable . #t)
        (stacking-dir . 1)
-       (break-align-orders . #((instrument-name left-edge ambitus breathing-sign
-                                                clef key-signature staff-bar
+       (break-align-orders . #(; end-of-line:
+                               (instrument-name left-edge ambitus breathing-sign
+                                                clef  staff-bar key-signature
                                                 time-signature custos)
                                (instrument-name left-edge ambitus breathing-sign
                                                 clef  staff-bar key-signature
                                                 staff
                                                 time-signature custos)
                                (instrument-name left-edge ambitus breathing-sign
-                                                clef  staff-bar key-signature
+                                                clef key-signature staff-bar
                                                 time-signature custos)
 
                                ))