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 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
@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
}
@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.
protected:
/* MAIN ROUTINES */
virtual void process (String);
-
private:
/// before calc_breaking
void preprocess ();
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 ));
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;
/*
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));
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,
ADD_INTERFACE (Ottava_bracket, "ottava-bracket-interface",
"An ottava bracket",
- "edge-height bracket-flare shorten-pair");
+ "edge-height bracket-flare shorten-pair minimum-length");
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);
/*
- todo: use symbols and hashtable idx?
+ Todo: use symbols and hashtable idx?
*/
Font_metric *
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
{
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);
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)
{
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 ());
}
;
}
| SCORE_IDENTIFIER {
- $$ = unsmob_score ($1);
+ $$ = new Score ( *unsmob_score ($1));
$$->set_spot (THIS->here_input ());
}
| score_body lilypond_header {
}
| score_body output_def {
$$->defs_.push ($2);
+ scm_gc_unprotect_object ($2->self_scm ());
}
| score_body error {
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 {
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 {
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
SCM k= ly_symbol2scm (classname (t));
global_translator_dict->set (k, t->self_scm ());
+
+ scm_gc_unprotect_object (t->self_scm ());
}
Translator*
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;
}
-/*
- 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];
-}
/*
% Toplevel initialisation file.
-
-
#(define-public point-and-click #f)
#(define-public midi-debug #f)
(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.")
(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)
(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.
"""))
+def conv (str):
+ str =re.sub (r"OttavaSpanner", r"OttavaBracket", str)
+ return str
+
+conversions.append (((2,1,12), conv, """OttavaSpanner -> OttavaBracket"""))
+
+
################################
# END OF CONVERSIONS
################################
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)