+2002-11-19 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/grob.cc (warning): better robustness fix.
+
+2002-11-19 Juergen Reuter <reuter@ipd.uka.de>
+
+ * lily/cluster-engraver.cc: bugfix: use protected scm upon columns
+
+ * lily/cluster-engraver.cc: stick better to variable naming
+ conventions
+
+ * lily/cluster-engraver.cc: bugfix: delay typesetting of cluster
+ until stop_translation_timestep()
+
+ * lily/cluster-engraver.cc, lily/cluster.cc: design fix: pass
+ min/max coordinates to backend, but no musical info such as
+ pitches
+
+ * lily/cluster.cc: robustness fix: do not crash upon empty cluster
+
+ * lily/grob.cc: robustness fix: warning(): do not crash if
+ cause is not set
+
+ * lily/ligature-bracket-engraver.cc, scm/grob-description.scm: use
+ the much more elaborated tuplet brackets than the very naive and
+ simple ligature bracket grob
+
2002-11-19 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* Documentation/user/refman.itely (Analysis brackets): add
* input/*.ly: update syntax to 1.7 + new-chords.
+ * VERSION: 1.7.7 released.
+
* Documentation/user/*.tely: new chord syntax.
* input/regression/[bc]*.ly (texidoc): syntax updates.
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=7
-PATCH_LEVEL=7
+PATCH_LEVEL=8
MY_PATCH_LEVEL=
# Use the above to send patches: MY_PATCH_LEVEL is always empty for a
dnl aclocal.m4 -*-shell-script-*-
dnl WARNING WARNING WARNING
-dnl do not edit! this is aclocal.m4, generated from /home/fred/lily/stepmake/aclocal.m4
+dnl do not edit! this is aclocal.m4, generated from /users/hanwen/usr/src/lilypond/stepmake/aclocal.m4
dnl aclocal.m4 -*-shell-script-*-
dnl StepMake subroutines for configure.in
#!/bin/sh
-# WARNING WARNING WARNING
-# do not edit! this is autogen.sh, generated from /home/fred/lily/stepmake/autogen.sh
-#!/bin/sh
# Run this to generate configure and initial GNUmakefiles
srcdir=`dirname $0`
#include "item.hh"
#include "spanner.hh"
#include "note-head.hh"
+#include "protected-scm.hh"
#include "warn.hh"
class Cluster_engraver : public Engraver
private:
Drul_array<Music*> reqs_drul_;
- Pitch pitch_min, pitch_max;
- Spanner *cluster;
- SCM columns_scm;
+ Pitch pitch_min_, pitch_max_;
+ Spanner *cluster_;
+ SCM columns_scm_;
};
void reset_min_max (Pitch *pitch_min, Pitch *pitch_max)
Cluster_engraver::Cluster_engraver ()
{
- cluster = 0;
- columns_scm = SCM_EOL;
+ cluster_ = 0;
+ columns_scm_ = SCM_EOL;
reqs_drul_[LEFT] = reqs_drul_[RIGHT] = 0;
}
{
reqs_drul_[START] = 0;
reqs_drul_[STOP] = 0;
- if (cluster)
+ if (cluster_)
{
- cluster->suicide ();
- cluster = 0;
- columns_scm = SCM_EOL;
+ cluster_->suicide ();
+ cluster_ = 0;
+ columns_scm_ = SCM_EOL;
}
}
else if (m->is_mus_type ("cluster-event"))
{
if (reqs_drul_[STOP])
{
- if (!cluster)
+ if (!cluster_)
{
reqs_drul_[STOP]->origin ()->warning ("can't find start of cluster");
}
else
{
Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
- cluster->set_bound (RIGHT, bound);
- cluster->set_grob_property ("segments", columns_scm);
- typeset_grob (cluster);
- cluster = 0;
- columns_scm = SCM_EOL;
+ cluster_->set_bound (RIGHT, bound);
}
- reqs_drul_[STOP] = 0;
}
if (reqs_drul_[START])
{
- if (cluster)
+ if (cluster_)
{
reqs_drul_[START]->origin ()->warning ("may not nest clusters");
}
else
{
SCM basicProperties = get_property ("Cluster");
- cluster = new Spanner (basicProperties);
- columns_scm = SCM_EOL;
+ cluster_ = new Spanner (basicProperties);
+ columns_scm_ = SCM_EOL;
Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
- cluster->set_bound (LEFT, bound);
- announce_grob (cluster, bound->self_scm ());
+ cluster_->set_bound (LEFT, bound);
+ announce_grob (cluster_, bound->self_scm ());
}
reqs_drul_[START] = 0;
}
void
Cluster_engraver::start_translation_timestep ()
{
- reset_min_max (&pitch_min, &pitch_max);
+ reset_min_max (&pitch_min_, &pitch_max_);
}
void
Cluster_engraver::stop_translation_timestep ()
{
- if (cluster)
+ if (cluster_)
{
SCM column_scm = get_property ("currentMusicalColumn");
if (column_scm == SCM_EOL)
{
programming_error("failed retrieving current column");
- return;
}
-
- if (Pitch::compare (pitch_min, pitch_max) <= 0)
+ else
{
- int staff_position = pitch_min.steps ();
- SCM c0 = get_property ("centralCPosition");
- if (gh_number_p (c0))
- staff_position += gh_scm2int (c0);
- SCM segment = scm_list_n (column_scm,
- gh_int2scm (staff_position),
- pitch_min.smobbed_copy (),
- pitch_max.smobbed_copy (),
- SCM_UNDEFINED);
- segment = scm_list_n (segment, SCM_UNDEFINED);
- columns_scm = (columns_scm != SCM_EOL) ?
- gh_append2 (columns_scm, segment) : segment;
+ if (Pitch::compare (pitch_min_, pitch_max_) <= 0)
+ {
+ Real y_bottom = 0.5 * pitch_min_.steps ();
+ SCM c0 = get_property ("centralCPosition");
+ if (gh_number_p (c0))
+ y_bottom += 0.5 * gh_scm2int (c0);
+ else
+ programming_error ("Cluster_engraver: failed evaluating c0");
+ Real y_top = y_bottom +
+ 0.5 * (pitch_max_.steps () - pitch_min_.steps ());
+ column_scm = Protected_scm (column_scm);
+ SCM segment = scm_list_n (column_scm,
+ gh_double2scm (y_bottom),
+ gh_double2scm (y_top),
+ SCM_UNDEFINED);
+ segment = scm_list_n (segment, SCM_UNDEFINED);
+ columns_scm_ = (columns_scm_ != SCM_EOL) ?
+ gh_append2 (columns_scm_, segment) : segment;
+ cluster_->set_grob_property ("segments", columns_scm_); // Urrgh!
+ }
+ else
+ {
+ /* This timestep is caused by a different voice of the
+ same staff and hence should be ignored. */
+ }
}
- else
+
+ if (reqs_drul_[STOP])
{
- /* This timestep is caused by a different voice of the same
- staff and hence should be ignored. */
+ reqs_drul_[STOP] = 0;
+ cluster_->set_grob_property ("segments", columns_scm_);
+ typeset_grob (cluster_);
+ cluster_ = 0;
+ columns_scm_ = SCM_EOL;
}
}
}
if (nr && nr->is_mus_type ("note-event"))
{
Pitch pitch = *unsmob_pitch (nr->get_mus_property ("pitch"));
- if (Pitch::compare (pitch_min, pitch_max) > 0) // already init'd?
+ if (Pitch::compare (pitch_min_, pitch_max_) > 0) // already init'd?
{
// not yet init'd; use current pitch to init min/max
- pitch_min = pitch;
- pitch_max = pitch;
+ pitch_min_ = pitch;
+ pitch_max_ = pitch;
}
- else if (Pitch::compare (pitch, pitch_max) > 0) // new max?
+ else if (Pitch::compare (pitch, pitch_max_) > 0) // new max?
{
- pitch_max = pitch;
+ pitch_max_ = pitch;
}
- else if (Pitch::compare (pitch, pitch_min) < 0) // new min?
+ else if (Pitch::compare (pitch, pitch_min_) < 0) // new min?
{
- pitch_min = pitch;
+ pitch_min_ = pitch;
}
}
}
Grob *me = unsmob_grob (smob);
Spanner *spanner = dynamic_cast<Spanner*> (me);
- if (!spanner) {
- me->programming_error ("Cluster::brew_molecule(): not a spanner");
- return SCM_EOL;
- }
+ if (!spanner)
+ {
+ me->programming_error ("Cluster::brew_molecule(): not a spanner");
+ return SCM_EOL;
+ }
Item *left_bound = spanner->get_bound (LEFT);
Item *right_bound = spanner->get_bound (RIGHT);
bottom_points.clear ();
top_points.clear ();
SCM column_scm = SCM_EOL;
- for (SCM columns_scm = me->get_grob_property ("segments");
+
+ SCM columns_scm = me->get_grob_property ("segments");
+ if (columns_scm == SCM_EOL)
+ {
+ me->warning ("junking empty cluster");
+ return SCM_EOL;
+ }
+
+ for (;
columns_scm != SCM_EOL;
columns_scm = ly_cdr (columns_scm)) {
column_scm = ly_car (columns_scm);
break; // ok, we have seen all columns
column = unsmob_grob (col_scm);
column_scm = ly_cdr (column_scm);
- Real y = 0.5 * gh_scm2double (ly_car (column_scm));
- column_scm = ly_cdr (column_scm);
- Pitch *pitch_min = unsmob_pitch (ly_car (column_scm));
+ Real y_bottom = gh_scm2double (ly_car (column_scm));
column_scm = ly_cdr (column_scm);
- Pitch *pitch_max = unsmob_pitch (ly_car (column_scm));
- Real height = 0.5 * (pitch_max->steps () - pitch_min->steps ());
+ Real y_top = gh_scm2double (ly_car (column_scm));
Real x = column->relative_coordinate (common, X_AXIS);
if (right_broken)
x -= left_bound->relative_coordinate (common, X_AXIS);
- bottom_points.push (Offset (x, y));
- top_points.push (Offset (x, y + height));
+ bottom_points.push (Offset (x, y_bottom));
+ top_points.push (Offset (x, y_top));
}
if (right_broken)
{
- Real y = 0.5 * gh_scm2double (ly_car (column_scm));
+ Real y_bottom = gh_scm2double (ly_car (column_scm));
column_scm = ly_cdr (column_scm);
- Pitch *pitch_min = unsmob_pitch (ly_car (column_scm));
+ Real y_top = gh_scm2double (ly_car (column_scm));
column_scm = ly_cdr (column_scm);
- Pitch *pitch_max = unsmob_pitch (ly_car (column_scm));
- Real height = 0.5 * (pitch_max->steps () - pitch_min->steps ());
Real x =
right_bound->relative_coordinate (common, X_AXIS) -
left_bound->relative_coordinate (common, X_AXIS);
- bottom_points.push (Offset (x, y));
- top_points.push (Offset (x, y + height));
+ bottom_points.push (Offset (x, y_bottom));
+ top_points.push (Offset (x, y_top));
}
Molecule out = brew_cluster_piece (me, bottom_points, top_points);
return out.smobbed_copy ();
Grob::warning (String s)const
{
SCM cause = self_scm();
- while (cause != SCM_EOL && !unsmob_music (cause))
+ while (Grob * g = unsmob_grob (cause))
{
- Grob * g = unsmob_grob (cause);
cause = g->get_grob_property ("cause");
}
*/
#include "ligature-engraver.hh"
+#include "note-column.hh"
+#include "tuplet-bracket.hh"
#include "spanner.hh"
#include "warn.hh"
{
protected:
virtual Spanner *create_ligature_spanner ();
+ virtual void acknowledge_grob (Grob_info);
public:
TRANSLATOR_DECLARATIONS(Ligature_bracket_engraver);
return new Spanner (get_property ("LigatureBracket"));
}
+void
+Ligature_bracket_engraver::acknowledge_grob (Grob_info info)
+{
+ if (ligature_)
+ {
+ if (Note_column::has_interface (info.grob_))
+ {
+ Tuplet_bracket::add_column (ligature_, dynamic_cast<Item*> (info.grob_));
+ }
+ else Ligature_engraver::acknowledge_grob (info);
+ }
+}
+
ENTER_DESCRIPTION(Ligature_bracket_engraver,
/* descr */ "Handles Ligature_events by engraving Ligature brackets.",
-/* creats*/ "LigatureBracket",
+/* creats*/ "TupletBracket",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface rest-interface",
+/* acks */ "ligature-head-interface rest-interface note-column-interface",
/* reads */ "",
/* write */ "");
(LigatureBracket
. (
- (width . 0.75)
- (height . 0.5)
(ligature-primitive-callback . ,Note_head::brew_molecule)
- (molecule-callback . ,Ligature_bracket::brew_molecule)
- (meta . ((interfaces . (ligature-bracket-interface spanner-interface))))
+ (direction . 1)
+ (gap . 0.0)
+ (padding . 2.0)
+ (thickness . 1.6)
+ (edge-widen . (0.0 . 0.0))
+ (edge-height . (0.7 . 0.7))
+ (shorten-pair . (-0.2 . -0.2))
+ (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
+ (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking)
+ (molecule-callback . ,Tuplet_bracket::brew_molecule)
+ (meta . ((interfaces . (tuplet-bracket-interface spanner-interface))))
))
(LigatureHead