\version "1.3.93";
-rh=\property Thread.noteHeadStyle=##f
-lh=\property Thread.noteHeadStyle = #'diamond
-n=\property Thread.fontSize=#0
-sm=\property Thread.fontSize=#-1
+rh=\property Thread.NoteHead \push #'style = #'default
+lh=\property Thread.NoteHead \push #'style = #'diamond
+
+n = \property Thread.NoteHead \pop #'font-size % = #'diamond %\property Thread.fontSize=#0
+sm=\property Thread.NoteHead \push #'font-size = #-1
+
% su=\property Voice.verticalDirection=#1
% sd=\property Voice.verticalDirection=#-1
su=\property Voice.Stem \push #'direction = #1
sd=\property Voice.Stem \push #'direction = #-1
-zs=\property Voice.forceHorizontalShift=#0.0
+
+%{
ls=\property Voice.forceHorizontalShift=#-0.6
sls=\property Voice.forceHorizontalShift=#-0.22
rs=\property Voice.forceHorizontalShift=#0.6
srs=\property Voice.forceHorizontalShift=#0.22
+%}
+zs = \property Voice.NoteColumn \pop #'force-hshift % #0.0
+ls = \property Voice.NoteColumn \push #'force-hshift = #-0.6
+sls= \property Voice.NoteColumn \push #'force-hshift = #-0.22
+rs = \property Voice.NoteColumn \push #'force-hshift = #0.6
+srs= \property Voice.NoteColumn \push #'force-hshift = #0.22
+
+
+
ab=\property Voice.noAutoBeaming=##f
xb=\property Voice.noAutoBeaming=##t
= Pointer_group_interface__extract_elements ( me, (Score_element*) 0, "elements");
for (int i=0; i < all_elts.size(); i++)
{
- Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (me, a);
+ Interval y = all_elts[i]->extent(me, a);
if (!y.empty_b())
{
Score_element *e =dynamic_cast<Score_element*>(all_elts[i]);
for (int i=0; i < all_elems.size(); i++)
{
- Interval y = all_elems[i]->extent(X_AXIS);
+ Interval y = all_elems[i]->extent(all_elems[i], X_AXIS);
if (!y.empty_b())
elems.push (dynamic_cast<Score_element*> (all_elems[i]));
}
Real pre_space = elems[0]->relative_coordinate (column, X_AXIS);
- Real xl = elems[0]->extent (X_AXIS)[LEFT];
+ Real xl = elems[0]->extent (elems[0],X_AXIS)[LEFT];
if (!isinf (xl))
pre_space += xl;
else
programming_error ("Infinity reached. ");
- Real xr = elems.top ()->extent (X_AXIS)[RIGHT];
+ Real xr = elems.top ()->extent (elems.top (), X_AXIS)[RIGHT];
Real spring_len = elems.top ()->relative_coordinate (column, X_AXIS);
if (!isinf (xr))
spring_len += xr;
#include "debug.hh"
#include "paper-column.hh"
-void
-Crescendo::set_interface (Score_element*s)
-{
- s->set_elt_property ("dynamic-drul", gh_cons (SCM_EOL, SCM_EOL));
-}
-
-
-
-MAKE_SCHEME_CALLBACK(Crescendo,brew_molecule,1);
-
-/*
-
- TODO:
-
- * should span the crescendo on any dynamic-text items, and
- calculate their dimensions to determine shortening; junk shortening
- code and related elt props.
-
- * separate the dashed-line version and the hairpin version into two
- brew_molecule functions.
+MAKE_SCHEME_CALLBACK (Crescendo, brew_molecule, 1);
- * generalise dashed-line into generic text spanner, for ottava, accelerando, etc.
-
-
-*/
SCM
Crescendo::brew_molecule (SCM smob)
{
Score_element *me= unsmob_element (smob);
- Spanner * sp = dynamic_cast<Spanner*>(me);
- Real ss = me->paper_l ()->get_var ("staffspace");
- Real sl = me->paper_l ()->get_var ("stafflinethickness");
+ Spanner *span = dynamic_cast<Spanner*>(me);
+ Real staff_space = me->paper_l ()->get_var ("staffspace");
+ Real line = me->paper_l ()->get_var ("stafflinethickness");
- Real absdyn_dim = gh_scm2double (me->get_elt_property ("shorten-for-letter"));
- Real extra_left = sp->get_broken_left_end_align ();
+ Real broken_left = span->get_broken_left_end_align ();
- SCM dir = me->get_elt_property("grow-direction");
- SCM dyns = me->get_elt_property ("dynamic-drul");
-
- if (!isdir_b (dir) || !gh_pair_p (dyns))
+ SCM s = me->get_elt_property("grow-direction");
+ if (!isdir_b (s))
{
me->suicide ();
return SCM_EOL;
}
- Direction gd = to_dir (dir);
+ Direction grow_dir = to_dir (s);
- bool dynleft= unsmob_element (gh_car (dyns));
- bool dynright = unsmob_element (gh_cdr (dyns));
-
- if (dynleft)
- extra_left += absdyn_dim;
-
- Real width = sp->spanner_length()- sp->get_broken_left_end_align ();
-
- if (dynleft)
- {
- width -= absdyn_dim;
- }
- if (dynright)
- {
- width -= absdyn_dim;
- }
+ Real width = span->spanner_length ();
+ width -= span->get_broken_left_end_align ();
if (width < 0)
{
- warning (_ ("crescendo") + " " + _ ("too small"));
+ warning (_ ((grow_dir < 0) ? "decrescendo too small"
+ : "crescendo too small"));
width = 0;
}
Direction d = LEFT;
do
{
- Paper_column* s = dynamic_cast<Paper_column*>(sp->get_bound (d)); // UGH
+ Paper_column* s = dynamic_cast<Paper_column*> (span->get_bound (d)); // UGH
broken[d] = (!s->musical_b ());
}
while (flip (&d) != LEFT);
-
- Molecule m;
+ bool continued = broken[Direction (-grow_dir)];
+ Real height = staff_space * gh_scm2double (me->get_elt_property ("height"));
+ Real thick = line * gh_scm2double (me->get_elt_property ("thickness"));
- Real pad = 0;
- SCM s = me->get_elt_property ("start-text");
- if (gh_string_p (s))
- {
- Molecule start_text (me->lookup_l ()->text ("italic",
- ly_scm2string (s),
- me->paper_l ()));
- m.add_molecule (start_text);
-
- pad = me->paper_l ()->get_var ("staffspace") / 2; // ugh.
-
- width -= start_text.extent (X_AXIS).length ();
- width -= pad;
- width = width >? 0;
- }
-
- SCM at;
- s =me->get_elt_property ("spanner");
- Real height;
-
- if (gh_string_p (s) && ly_scm2string (s) == "dashed-line")
- {
- Real thick = gh_scm2double (me->get_elt_property ("dash-thickness")) * sl ;
- Real dash = gh_scm2double (me->get_elt_property ("dash-length")) * ss;
-
- height = thick;
- at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()),
- gh_double2scm (thick),
- gh_double2scm (dash),
- gh_double2scm (width),
- SCM_UNDEFINED);
- }
- else
- {
- bool continued = broken[Direction (-gd)];
- height = ss * gh_scm2double (me->get_elt_property ("height"));
- Real thick = sl * gh_scm2double (me->get_elt_property ("thickness"));
-
- const char* hairpin = (gd < 0)? "decrescendo" : "crescendo";
-
- at = gh_list (ly_symbol2scm (hairpin),
+ const char* type = (grow_dir < 0) ? "decrescendo" : "crescendo";
+ SCM hairpin = gh_list (ly_symbol2scm (type),
gh_double2scm (thick),
gh_double2scm (width),
gh_double2scm (height),
gh_double2scm (continued ? height/2 : 0.0),
SCM_UNDEFINED);
- }
- Box b (Interval (0, width), Interval (-2*height, 2*height));
- Molecule span (b, at);
- m.add_at_edge (X_AXIS, RIGHT, span, pad);
- m.translate_axis (extra_left, X_AXIS);
+ Box b (Interval (0, width), Interval (-2*height, 2*height));
+ Molecule mol (b, hairpin);
+ mol.translate_axis (broken_left, X_AXIS);
- return m.create_scheme ();
+ return mol.create_scheme ();
}
if (line_spanner_)
line_spanner_->suicide ();
line_spanner_ = 0;
+ if (cresc_p_)
+ cresc_p_->suicide ();
+ cresc_p_ = 0;
}
else if ((s->span_type_str_ == "crescendo"
|| s->span_type_str_ == "decrescendo"))
else
{
current_cresc_req_ = accepted_spanreqs_drul_[START];
- cresc_p_ = new Spanner (get_property ("Crescendo"));
- Crescendo::set_interface (cresc_p_);
- cresc_p_->set_elt_property
- ("grow-direction",
- gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo")
- ? BIGGER : SMALLER));
-
- SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C());
- if (gh_string_p (s))
- {
- cresc_p_->set_elt_property ("start-text", s);
- daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
- + "Text", SCM_UNDEFINED);
- }
-
- s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C());
-
/*
TODO: Use symbols.
*/
- if (gh_string_p (s)) //&& ly_scm2string (s) != "hairpin")
+ SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C());
+
+ if (!gh_string_p (s) || ly_scm2string (s) == "hairpin")
+ {
+ cresc_p_ = new Spanner (get_property ("Crescendo"));
+ cresc_p_->set_elt_property ("grow-direction",
+ gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo")
+ ? BIGGER : SMALLER));
+
+ }
+ /*
+ This is a convenient (and legacy) interface to TextSpanners
+ for use in (de)crescendi.
+ Hmm.
+ */
+ else
{
- cresc_p_->set_elt_property ("spanner", s);
+ cresc_p_ = new Spanner (get_property ("TextSpanner"));
+ cresc_p_->set_elt_property ("type", s);
daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
+ "Spanner", SCM_UNDEFINED);
+ s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C());
+ if (gh_string_p (s))
+ {
+ cresc_p_->set_elt_property ("edge-text",
+ gh_cons (s, ly_str02scm ("")));
+ daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
+ + "Text", SCM_UNDEFINED);
+ }
}
-
+
Score_element *cc = unsmob_element (get_property ("currentMusicalColumn"));
cresc_p_->set_bound (LEFT, cc);
-
- /*
- We know how wide the text is, if we can be sure that the
- text already has relevant pointers into the paperdef,
- and it has its font-size property set.
-
- Since font-size may be set by a context higher up, we
- can not be sure of the size.
-
-
- We shouldn't try to do this stuff here, the Item should
- do it when the score is finished. We could maybe
- set a callback to have the Item do the alignment if
- it is not a special symbol, like Crescendo.
- */
-
-
if (text_p_)
{
- index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"),
- LEFT, text_p_->self_scm ());
-
- if (finished_cresc_p_
- // I don't see why, but we need this check
- && gh_pair_p (finished_cresc_p_->get_elt_property ("dynamic-drul")))
- index_set_cell (finished_cresc_p_->get_elt_property ("dynamic-drul"),
- RIGHT, text_p_->self_scm ());
+ Side_position::set_direction (text_p_, LEFT);
+ Side_position::set_axis (text_p_, X_AXIS);
+ Side_position::add_support (text_p_, cresc_p_);
}
Axis_group_interface::add_element (line_spanner_, cresc_p_);
do
{
- Real x = sp->get_bound (d)->relative_coordinate (common, X_AXIS);
- Interval ext = sp->get_bound (d)->extent (X_AXIS);
- bounds[d] = (x + ext[-d]);
+ bounds[d] = sp->get_bound (d)->extent (common, X_AXIS)[-d];
}
while (flip (&d) != LEFT);
struct Crescendo
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- static void set_interface(Score_element*);
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
static bool has_interface (Score_element*);
};
for administration of what was done already
*/
enum Score_element_status {
- ORPHAN=0, // not yet added to pstaff
- VIRGIN, // added to pstaff
+ ORPHAN=0, // not yet added to Paper_score
+ VIRGIN,
PRECALCING,
PRECALCED, // calcs before spacing done
POSTCALCING, // busy calculating. This is used to trap cyclic deps.
public:
bool empty_b (Axis a) const;
- Interval extent (Axis) const;
+
+ Interval extent (Score_element * refpoint, Axis) const;
/**
translate in one direction
#include "lily-guile.hh"
#include "lily-proto.hh"
+
/*
properties :
dir-list -- list of stem directions.
*/
-
struct Spaceable_element
{
/// set a minimum distance
--- /dev/null
+/*
+ text-spanner.hh -- declare Text_spanner
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+
+#ifndef TEXT_SPANNER_HH
+#define TEXT_SPANNER_HH
+
+#include "lily-guile.hh"
+
+class Text_spanner
+{
+public:
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+ static bool has_interface (Score_element*);
+};
+
+#endif /* TEXT_SPANNER_HH */
Lyric_extender::brew_molecule (SCM smob)
{
Spanner *sp = dynamic_cast<Spanner*> (unsmob_element (smob));
-
- Real leftext = sp->get_bound (LEFT)->extent (X_AXIS).length ();
+
+ // ugh: refp
+ Real leftext = sp->get_bound (LEFT)->extent (sp->get_bound (LEFT),
+ X_AXIS).length ();
Real ss = sp->paper_l ()->get_var ("staffspace");
Real sl = sp->paper_l ()->get_var ("stafflinethickness");
Real righttrim = 0.5; // default to half a staffspace gap on the right
}
else
{
- Interval ext (rc->extent (X_AXIS));
+ Interval ext (rc->extent (rc, X_AXIS));
right_dist = ext.empty_b() ? 0.0 : - ext [LEFT];
}
Spacing_spanner::default_bar_spacing (Score_element*me, Score_element *lc, Score_element *rc,
Moment shortest)
{
- Real symbol_distance = lc->extent (X_AXIS)[RIGHT] ;
+ Real symbol_distance = lc->extent (lc,X_AXIS)[RIGHT] ;
Real durational_distance = 0;
Moment delta_t = Paper_column::when_mom (rc) - Paper_column::when_mom (lc);
*/
Real whole_note_correction;
if (Stem::invisible_b (stem ))
- whole_note_correction = -Stem::get_direction (stem )
- * Stem::support_head (stem )->extent (X_AXIS).length () / 2;
+ {
+ Score_element *hed = Stem::support_head (stem );
+ whole_note_correction = -Stem::get_direction (stem )
+ *hed->extent (hed, X_AXIS).length () / 2;
+ }
else
whole_note_correction = 0;
lyric_list_.push(lyric);
/* record longest and shortest lyrics */
if( longest_lyric_l_ ) {
- if(lyric->extent(X_AXIS).length() > (longest_lyric_l_->extent(X_AXIS)).length())
+ if(lyric->extent(lyric,X_AXIS).length() > (longest_lyric_l_->extent(longest_lyric_l_, X_AXIS)).length())
longest_lyric_l_ = lyric;
- if(lyric->extent(X_AXIS).length() < (shortest_lyric_l_->extent(X_AXIS)).length())
+ if(lyric->extent(lyric, X_AXIS).length() < (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length())
shortest_lyric_l_ = lyric;
}
else
// Right:
Real ss = extender->paper_l ()->get_var ("staffspace");
extender->set_elt_property("right-trim-amount",
- gh_double2scm(-notehead_l_->extent(X_AXIS).length()/ss));
+ gh_double2scm(-notehead_l_->extent(notehead_l_, X_AXIS).length()/ss));
}
}
lyric->set_parent(notehead_l_, X_AXIS);
lyric->add_offset_callback (Side_position::centered_on_parent_proc, X_AXIS);
// reference is on the right of the notehead; move it left half way, and add translation
- lyric->translate_axis (group_translation_f_-(notehead_l_->extent(X_AXIS)).center(), X_AXIS);
+ lyric->translate_axis (group_translation_f_-(notehead_l_->extent(notehead_l_, X_AXIS)).center(), X_AXIS);
}
}
return (notehead_l_);
Real translate = 0.0;
if(alignment_i_ != CENTER) {
// FIXME: do we really know the lyric extent here? Some font sizing comes later?
- if((longest_lyric_l_->extent(X_AXIS)).length() <
- (shortest_lyric_l_->extent(X_AXIS)).length() * 2 )
- translate = alignment_i_*(longest_lyric_l_->extent(X_AXIS)).length()/2;
- else
- translate = alignment_i_*(shortest_lyric_l_->extent(X_AXIS)).length();
+ Real l1 = longest_lyric_l_->extent(longest_lyric_l_, X_AXIS).length() / 2;
+ Real l2 = shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS).length();
+
+ translate = l1 <? l2;
+ translate *= alignment_i_ ;
}
return translate;
}
switch (alignment_i_) {
// case LEFT: // that's all
case CENTER: // move right so smallest lyric is left-aligned on notehead
- translation += (shortest_lyric_l_->extent(X_AXIS)).length()/2;
+ translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()/2;
break;
case RIGHT: // move right so smallest lyric is left-aligned on notehead
- translation += (shortest_lyric_l_->extent(X_AXIS)).length();
+ translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length();
break;
}
group_translation_f_ += translation;
Real left_x;
if (Note_head::has_interface (me->get_bound (LEFT)))
- left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f;
+ left_x = l->extent (l, X_AXIS)[RIGHT] + x_gap_f;
else
- left_x = l->extent (X_AXIS).length () / 2;
+ left_x = l->extent (l, X_AXIS).length () / 2;
Real width;
if (Note_head::has_interface (me->get_bound (LEFT))
&& Note_head::has_interface (me->get_bound (RIGHT)))
{
- width = r->relative_coordinate (commonx, X_AXIS)
- + r->extent (X_AXIS)[LEFT]
- - l->relative_coordinate (commonx, X_AXIS)
- - l->extent (X_AXIS)[RIGHT]
+ width =
+ + r->extent (commonx,X_AXIS)[LEFT]
+ - l->extent (commonx, X_AXIS)[RIGHT]
-2 * x_gap_f;
}
else
{
if (Note_head::has_interface (me->get_bound (LEFT)))
width = r->relative_coordinate (commonx, X_AXIS)
- - l->relative_coordinate (commonx, X_AXIS)
- - l->extent (X_AXIS)[RIGHT]
+ - l->extent (commonx, X_AXIS)[RIGHT]
- 2 * x_gap_f;
else
- width = r->relative_coordinate (commonx, X_AXIS)
- - l->extent (X_AXIS).length () / 2
- + r->extent (X_AXIS)[LEFT]
+ width =
+ - l->extent (l, X_AXIS).length () / 2
+ + r->extent (commonx, X_AXIS)[LEFT]
- l->relative_coordinate (commonx, X_AXIS)
- 2 * x_gap_f;
}
Offset leave_dir = b.control_[1] - b.control_[0];
- Real dx = (head (me, headdir)->extent (X_AXIS).length () + x_gap_f)/2.0;
+ Score_element *hed =head (me, headdir);
+ Real dx = (hed->extent (hed, X_AXIS).length () + x_gap_f)/2.0;
Real max_gap = leave_dir[Y_AXIS] * dx / leave_dir[X_AXIS];
/*