]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/tuplet-bracket.cc (calc_position_and_height): check musical
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 19 Jan 2004 12:34:05 +0000 (12:34 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 19 Jan 2004 12:34:05 +0000 (12:34 +0000)
slope against graphical slope.

* lily/ottava-bracket.cc (brew_molecule): support minimum-length
for ottava bracket.

* lily/side-position-interface.cc (general_side_position):
opps. reinstate *dir.

* lily/parser.yy: plug many memory leaks. We're down to 4 for each
parser run.

* lily/tuplet-bracket.cc: remove calc_dy ().

* Documentation/user/refman.itely (Balloon help): document balloon
help

19 files changed:
ChangeLog
Documentation/user/refman.itely
lily/include/paper-score.hh
lily/include/tuplet-bracket.hh
lily/music-output-def.cc
lily/ottava-bracket.cc
lily/ottava-engraver.cc
lily/paper-def.cc
lily/paper-score.cc
lily/parser.yy
lily/side-position-interface.cc
lily/translator-ctors.cc
lily/tuplet-bracket.cc
ly/init.ly
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/lily.scm
scripts/convert-ly.py
scripts/lilypond-book.py

index 7e3a118da2d796466192fc6469157330bf4c2764..87d8afc3fa0f045923dac5fa4f8be2c3d449d77d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,30 @@
+2004-01-19  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/tuplet-bracket.cc (calc_position_and_height): check musical
+       slope against graphical slope.
+
+       * lily/ottava-bracket.cc (brew_molecule): support minimum-length
+       for ottava bracket.
+
+       * lily/side-position-interface.cc (general_side_position):
+       opps. reinstate *dir.
+
+       * lily/parser.yy: plug many memory leaks. We're down to 4 for each
+       parser run.
+
+       * lily/tuplet-bracket.cc: remove calc_dy ().
+
+       * Documentation/user/refman.itely (Balloon help): document balloon
+       help
+
 2004-01-19  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/document-backend.scm (check-dangling-properties): Grob
        properties are defined define-grob-properties.scm.
-
+       
 2004-01-19  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+       
+       * VERSION: release 2.1.12
 
        * scm/define-grobs.scm (all-grob-descriptions): larger font for
        ChordName
index a474382d0a824f5aa19c942d6f348991535982d7..1e1046de27a609f3e21d5efe9da4715098a893ab 100644 (file)
@@ -7482,7 +7482,33 @@ such as fermatas to a @code{\notes@{@}} block.
 @node Balloon help
 @subsection Balloon help
 
+Elements of notation can be marked and named with the help of a square
+balloon.  The primary purpose of this feature is to explain notation.
 
+The following example demonstrates its use.
+
+@lilypond[verbatim,fragment,singleline,relative 1]
+  \context Voice
+     \applyoutput
+        #(add-balloon-text 'NoteHead "heads, or tails?"
+          '(1 . -3))
+  c8
+@end lilypond
+
+@noindent
+The function @code{add-balloon-text} takes the name of a grob, the
+label to print and where to put the label relative to the object. In
+the above example, the text ``heads or tails?'' ends 3 spaces below
+the `balloon.' 
+
+@cindex balloon
+@cindex notation, explaining
+
+@seealso
+
+Internals: @internalsref{text-balloon-interface}
+
+Examples: @inputfileref{input/regression,balloon.ly}
 
 @node Easy Notation note heads
 @subsection Easy Notation note heads
@@ -7500,19 +7526,14 @@ used in music aimed at beginners:
 }
 @end lilypond
 
-The @code{EasyNotation} variable overrides a @internalsref{Score} context.  
-You probably will want to print it with magnification or a
-large font size to make it more readable.  To print with
-magnification, you must create a DVI file (with @file{lilypond}) and
-then enlarge it with something like @file{dvips -x 2000 file.dvi}.
-See the @code{dvips} documentation for more details.  To print with a
-larger font, see @ref{Font Size}.
-
+The @code{EasyNotation} variable overrides a @internalsref{Score}
+context.  To make the letters readable, it has to be printed in a
+large font size.  To print with a larger font, see @ref{Font Size}.
 
 @cindex Xdvi
 @cindex ghostscript
 
-If you view the result with Xdvi, then staff lines will show through
+If you view the result with Xdvi, then staff lines may show through
 the letters.  Printing the PostScript file obtained does produce the
 correct result.
 
index 505a2fc5717fe64cbb5d93b3384a9c9e19ec5ace..d6ff25c7d60d1ed7276215db5c37bd99e0dbb134 100644 (file)
@@ -43,7 +43,6 @@ public:
 protected:
     /* MAIN ROUTINES */
   virtual void process (String);
-
 private:
   /// before calc_breaking
   void preprocess ();
index 004e1485a3d2f380fda373b0736c15023ee82a0b..c0c6be4540f2775783c0ef4b6c29c9c951347cfb 100644 (file)
@@ -26,7 +26,6 @@ public:
   static void add_column (Grob*me,Item*);
   static void add_beam (Grob*me,Grob*);
   static Grob *parallel_beam (Grob *me, Link_array<Grob> const&cols, bool *equally_long);
-  static void calc_dy (Grob*,Real *) ;
   static void calc_position_and_height (Grob*,Real*,Real *dy);
   
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
index ea96c452bed4dbcc04b953706ef985e15ae64bd9..c7ddfb2688c8af8fd1c784b22c7c37a09a79f1f2 100644 (file)
@@ -113,7 +113,9 @@ int
 Music_output_def::print_smob (SCM s, SCM p, scm_print_state *)
 {
   Music_output_def * def = unsmob_music_output_def (s);
-  scm_puts ("#<Music_output_def ", p);
+  scm_puts ("#< ", p);
+  scm_puts (classname (def), p);
+  
   (void)def;
   scm_puts (">", p);
   return 1;
index bd64057891a766ae3216e85fb6f1804a7bfd5ba5..1df2dbafbed885357c94d144931406e7fb68bdf3 100644 (file)
@@ -91,11 +91,15 @@ Ottava_bracket::brew_molecule (SCM smob)
   /*
     0.3 is ~ italic correction. 
    */
-  Real text_offset = text.extent (X_AXIS).is_empty ()
+  Real text_size =  text.extent (X_AXIS).is_empty ()
     ? 0.0 : text.extent (X_AXIS)[RIGHT] +  0.3;
-
+  
+  span_points[LEFT] = span_points[LEFT]
+    <? (span_points[RIGHT] - text_size
+       - robust_scm2double (me->get_grob_property ("minimum-length"), -1.0)); 
+  
   Interval bracket_span_points = span_points;
-  bracket_span_points[LEFT] += text_offset;
+  bracket_span_points[LEFT] += text_size;
   
   Drul_array<Real> edge_height = robust_scm2interval (me->get_grob_property ("edge-height"),
                                                      Interval (1.0, 1.0));
@@ -112,7 +116,7 @@ Ottava_bracket::brew_molecule (SCM smob)
     edge_height[RIGHT] = 0.0;
   
   Molecule b;
-  if (!bracket_span_points.is_empty ())
+  if (!bracket_span_points.is_empty () && bracket_span_points.length () > 0.001)
     b = Tuplet_bracket::make_bracket (me,
                                      Y_AXIS, Offset (bracket_span_points.length (), 0),
                                       edge_height,
@@ -133,5 +137,5 @@ Ottava_bracket::brew_molecule (SCM smob)
 
 ADD_INTERFACE (Ottava_bracket, "ottava-bracket-interface",
               "An ottava bracket",
-              "edge-height bracket-flare shorten-pair");
+              "edge-height bracket-flare shorten-pair minimum-length");
 
index fba507e10c335590769baf901239f8149d244912..c612e147ff12300afd43bbe2619c536610fdbf5b 100644 (file)
@@ -49,7 +49,7 @@ Ottava_spanner_engraver::process_music ()
       span_ = 0;
       if (gh_string_p (ott))
        {
-         span_  = new Spanner (get_property ("OttavaSpanner"));
+         span_  = new Spanner (get_property ("OttavaBracket"));
          span_->set_grob_property ("text", ott);
          announce_grob (span_, SCM_EOL);
 
index a784bfab15c72945522f9d061be1032a235fd52d..125eadbdfa2b51f2c5d94a250291819f26600ade 100644 (file)
@@ -85,7 +85,7 @@ Paper_def::get_paper_outputter (String outname)  const
 
 
 /*
-  todo: use symbols and hashtable idx?
+  Todo: use symbols and hashtable idx?
 */
 Font_metric *
 Paper_def::find_font (SCM fn, Real m)
@@ -103,7 +103,10 @@ Paper_def::find_font (SCM fn, Real m)
   Font_metric*  f=0;
   if (gh_list_p (fn))
     {
-      f = new Virtual_font_metric (fn, m, this);
+      f = new Virtual_font_metric (fn, m, this); // TODO: GC protection.
+      
+      scaled_fonts_ = scm_acons (key, f->self_scm (), scaled_fonts_);
+      scm_gc_unprotect_object (f->self_scm ());
     }
   else
     {
@@ -132,6 +135,9 @@ Paper_def::font_descriptions ()const
   for (SCM s = scaled_fonts_; gh_pair_p (s); s = ly_cdr (s))
     {
       SCM desc = ly_caar (s);
+      if (!gh_string_p (gh_car (desc)))
+       continue ;
+
       SCM mdesc = unsmob_metrics (ly_cdar (s))->description_;
 
       l = gh_cons (gh_cons (mdesc, desc), l);
index 5e31a512ec9d93861b63f6da213f60469e657b4f..887f4a7a6751530e428872091608825b7dd8c4f7 100644 (file)
@@ -42,15 +42,10 @@ Paper_score::typeset_line (System *l)
   main_smob_ = gh_cons (l->self_scm (), main_smob_);
   l->pscore_ = this;
 
-#if 0
-  /*
-    We don't unprotect l->self_scm (), we haven't got any place else to
-    protect it from collection.  */
-#endif
-
   scm_gc_unprotect_object (l->self_scm());
 }
 
+
 Paper_score::Paper_score (Paper_score const &s)
   : Music_output (s)
 {
index 91fd3b613f4c2161aec487b44b9798d52a89148d..a2da89103c3539fa21c3c7d6ff65b6b4d41997c3 100644 (file)
@@ -464,10 +464,13 @@ toplevel_expression:
                scm_gc_unprotect_object (sc->self_scm());
        }
        | output_def {
+               SCM id = SCM_EOL;
                if (dynamic_cast<Paper_def*> ($1))
-                       THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
+                       id = scm_makfrom0str ("$defaultpaper");
                else if (dynamic_cast<Midi_def*> ($1))
-                       THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
+                       id = scm_makfrom0str ("$defaultmidi");
+               THIS->lexer_->set_identifier (id,   $1->self_scm ());
+               scm_gc_unprotect_object ($1->self_scm ());
        }
        ;
 
@@ -645,7 +648,7 @@ score_body:
 
        }
        | SCORE_IDENTIFIER {
-               $$ = unsmob_score ($1);
+               $$ = new Score ( *unsmob_score ($1));
                $$->set_spot (THIS->here_input ());
        }
        | score_body lilypond_header    {
@@ -653,6 +656,7 @@ score_body:
        }
        | score_body output_def {
                $$->defs_.push ($2);
+               scm_gc_unprotect_object ($2->self_scm ());
        }
        | score_body error {
 
@@ -724,6 +728,7 @@ music_output_def_body:
                Midi_def * md = dynamic_cast<Midi_def*> ($$);
                if (md)
                        md->set_tempo (d->get_length (), m);
+               scm_gc_unprotect_object ($2->self_scm ());
        }
        | music_output_def_body error {
 
@@ -1993,6 +1998,8 @@ simple_element:
                velt->set_mus_property ("elements", scm_list_n (ev->self_scm (),SCM_UNDEFINED));
                velt->set_spot (i);
 
+               scm_gc_unprotect_object (ev->self_scm());
+
                $$ = velt;
        }
        | MULTI_MEASURE_REST optional_notemode_duration         {
index f10f80073a60e4f018a295815b34e5dc6ea6760d..af50501c946b6e007872fd589837126936987a5f 100644 (file)
@@ -106,7 +106,7 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte
   SCM minimum = me->get_grob_property ("minimum-space");
 
   Real total_off = dim.linear_combination (dir) - off;
-  total_off += robust_scm2double ( me->get_grob_property ("padding"), 0);
+  total_off += dir * robust_scm2double (me->get_grob_property ("padding"), 0);
 
   if (gh_number_p (minimum) 
       && dir
index 783c39698b56e2328c212e982d611a0ec540c0e3..a1e7fca4db529630660103a806077bf208621348 100644 (file)
@@ -38,6 +38,8 @@ add_translator (Translator *t)
 
   SCM k= ly_symbol2scm  (classname (t));
   global_translator_dict->set (k, t->self_scm ());
+
+  scm_gc_unprotect_object (t->self_scm ());
 }
 
 Translator*
index 7e589483ac6e1a3bec312ea3a45b39ca9718ac98..18e21a57df169a950532ec424632b43a1b5c2f94 100644 (file)
@@ -318,8 +318,20 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy)
       Interval lv =columns[l]->extent (commony, Y_AXIS);
       rv.unite (staff);
       lv.unite (staff);
+      Real graphical_dy =  rv[dir] - lv[dir];
+
+      Slice ls = Note_column::head_positions_interval (columns[l]);
+      Slice rs = Note_column::head_positions_interval (columns[r]);
       
-      *dy =  rv[dir] - lv[dir];
+      Interval musical_dy;
+      musical_dy[UP] = rs[UP] - ls[UP];
+      musical_dy[DOWN] = rs[DOWN] - ls[DOWN];
+      if (sign (musical_dy[UP]) != sign (musical_dy[DOWN]))
+       *dy = 0.0;
+      else if (sign (graphical_dy) != sign (musical_dy[DOWN]))
+       *dy = 0.0;
+      else
+       *dy = graphical_dy;
     }
   else
     * dy = 0;
@@ -379,22 +391,6 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy)
   
 }
 
-/*
-  use first -> last note for slope,
-*/
-void
-Tuplet_bracket::calc_dy (Grob*me,Real * dy)
-{
-  Link_array<Grob> columns=
-    Pointer_group_interface__extract_grobs (me, (Grob*)0, "note-columns");
-
-  /*
-    ugh. refps.
-   */
-  Direction d = get_grob_direction (me);
-  *dy = columns.top ()->extent (columns.top (), Y_AXIS) [d]
-    - columns[0]->extent (columns[0], Y_AXIS) [d];
-}
 
 
 /*
index 0bd5ec749a8611ffffcd5b95c48047edfd56fd3d..4971f643819506f51af0b6427a908ff9d167d3d2 100644 (file)
@@ -1,7 +1,5 @@
 % Toplevel initialisation file. 
 
-
-
 #(define-public point-and-click #f)
 #(define-public midi-debug #f)
 
index 5141b56c17ce93cfff3557a562961b9c6f3e4ff8..3550de13ce640fbe8ac3f35a7b9bec7aa05f10f1 100644 (file)
@@ -483,7 +483,6 @@ The following variables are predefined: @code{all-visible},
 (grob-property-description 'word-space ly:dimension? "elongate left (?) by this much (FIXME: cumbersome semantics).")
 
 (grob-property-description 'width ly:dimension? "width of a grob measured in staff space.")
-(grob-property-description 'width-correct ly:dimension? "width correction for (de)cresc. text spanners.")
 (grob-property-description 'x-gap ly:dimension? "horizontal gap between notehead and tie.")
 (grob-property-description 'x-offset ly:dimension? "extra horizontal offset for ligature heads.")
 (grob-property-description 'y-free ly:dimension? "minimal vertical gap between slur and noteheads or stems.")
index 18e30c6bf0b4c2f801d29e0832cadb40d8e8b0a9..d963bf5a7c2e0d6b0559a9a17b83ca343fa05acf 100644 (file)
        (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 2.0)
        (if-text-padding . 1.0)
-       (width-correct . -1.0)
        (dash-length . 4.0)
        (self-alignment-Y . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (font-family . roman)
        (style . line)
        (if-text-padding . 1.0)
-       (width-correct . 0)
        (enclose-bounds . #t)
        (direction . -1)
        (bracket-flare . (0.5 . 0.5))
 
        ;; urg, only for (de)cresc. text spanners
        (if-text-padding . 1.0)
-       (width-correct . -1)
        (dash-fraction . 0.2)
        (dash-period . 3.0)
        (direction . 1)
        (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
        ))
     
-    (OttavaSpanner
+    (OttavaBracket
      . (
        (Y-offset-callbacks . (,Side_position_interface::out_of_staff
                               ,Side_position_interface::aligned_side))
        (staff-padding . 1.0)
        (padding  . 1.0)
        (enclose-bounds . #t)
-       (width-correct . 0.0)
-       (style . dashed-line)
+       (minimum-length . 1.0)
        (dash-fraction . 0.3)
        (edge-height . (0 . 1.2))
        (direction . 1)
index 63d09e7d70e495c15edaf815dc8dabc98977f2ba..a1d7552b1c6c80ec073c65c8df6d277c4c00920a 100644 (file)
@@ -13,6 +13,8 @@
             (srfi srfi-13)             ;strings
             )
 
+(define-public (myd k v) (display k) (display ": ") (display v) (display ", "))
+
 ;;; General settings
 ;;; debugging evaluator is slower.  This should
 ;;; have a more sensible default.
index c09c24a366bcaec0d80119aa63295e9f4fd786d7..b896051802472b03dc998c0eb5bbc6f953f5d643 100644 (file)
@@ -1687,6 +1687,13 @@ conversions.append (((2,1,11), conv, """\\include "paper16.ly" -> #(set-staff-si
 """))
 
 
+def conv (str):
+       str =re.sub (r"OttavaSpanner", r"OttavaBracket", str)
+       return str
+
+conversions.append (((2,1,12), conv, """OttavaSpanner -> OttavaBracket"""))
+
+
 ################################
 #      END OF CONVERSIONS      
 ################################
index 10b5863d74321cb08e21436e7b85801ae0a5a991..65032d824b51e122922db6c21b328d43651bc144 100644 (file)
@@ -1414,7 +1414,8 @@ def compile_all_files (chunks):
                ly.system ("dvips -Ppdf -u+lilypond.map -E -o %s.eps %s" % (file, file))
        map (to_eps, eps)
 
-       map (ly.make_ps_images, map (lambda x: x + '.eps', png))
+       for p in png:
+               ly.make_ps_images (p + '.eps', resolution=110)
        os.chdir (d)