+pl 8.hwn1
+ - note-head-side
+ -
+
+
+
+***********
pl7.mb1
- bf: timeSignatureStyle works again
@end example
-@file{~/usr/src/bin/} is in the variable PATH, and contains symbolic
-links to the compiled executables.
+@file{~/usr/bin/} is in the variable PATH, and contains symbolic links
+to the compiled executables. Unpacked sources, releases and patches are
+in subdirectories under @file{~/usr/src/}.
@subsubsection Is there an emacs mode?
staff/lyricline
@example
- \score @{
+4 \score @{
< \melodic \type Staff = "treble" \trebleMelody
\lyric \type Lyrics = "tlyrics" \trebtext
\type Staff = "bass" \melodic \bassMelody
produce the graphical representation of rests for up to 10 bars.
The number of bars will be written above the sign.
-@mudelafile{mm-rest2.ly}
+@mudelafile{mm-rests2.ly}
A sharp sign after a double sharp sign, as well as a flat sign
after a double flat sign is automatically prepended with a
@contents
@node Top, , , (dir)
-@top
+
@menu
* Tutorial:: a tutorial introduction to lilypond.
* Invoking LilyPond:: Operation.
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=8
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=uu1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+
+\score { \notes { c1 \< \break \! c1 }}
--- /dev/null
+
+\header {
+ tagline="";
+}
+\version "1.3.5"
+\include "paper16.ly";
+\score {
+ \notes {
+ \relative c'' \sequential {
+ \clef "violin";
+ \time 5/4;
+ \key c;
+ <c4-\cr( g e>~ <dis ais e> <e, gis b> f )g-\rc
+ }
+ }
+ \paper{
+ linewidth = 5.0\cm;
+ }
+}
--- /dev/null
+
+
+thenotes = \notes \relative cis' { \time 4/4;
+gisis'4 gis gisis ges |
+geses ges geses gis |
+gisis g geses g |
+gis g ges g |
+\key a \major;
+gisis4 gis gisis ges |
+geses ges geses gis |
+gisis g geses g |
+gis g ges g |
+}
+
+\score { < \context Staff \thenotes
+ \context NoteNames \thenotes
+ >
+}
--- /dev/null
+thenotes = \notes \relative cis' {
+\property Score. skipBars = ##t
+\time 4/4;
+R1 |
+R1*1 |
+R1*2 |
+R1*3 |
+R1*4 |
+R1*5 |
+R1*6 |
+R1*7 |
+R1*8 |
+R1*9 |
+R1*10 |
+R1*11 |
+}
+
+\score { < \context Staff \thenotes
+ \context NoteNames \thenotes
+ >
+}
SCM al = get_property ("graceAlignPosition", 0);
if (isdir_b (al))
{
- align_item_p_->notehead_align_dir_ = to_dir (al);
+ align_item_p_->set_direction (to_dir (al));
}
typeset_element (align_item_p_);
if (!text_p_->parent_l(other_axis))
text_p_->set_parent (i,other_axis);
- Staff_sidify (text_p_).add_support (i);
+ Side_position_interface (text_p_).add_support (i);
/*
How do we make sure that text_p_ has a dependency from
text_p_ = new Text_item;
text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
- Staff_sidify staffside(text_p_);
+ Side_position_interface staffside(text_p_);
staffside.set_axis (axis_);
SCM prop = get_property (type_ + "Direction", 0);
Dot_column::Dot_column ()
{
- notehead_align_dir_ = RIGHT;
+ set_direction (RIGHT);
set_axes(X_AXIS,X_AXIS);
}
text_p_->set_elt_property ("style", gh_str02scm ("dynamic"));
text_p_->set_elt_property ("script-priority",
gh_int2scm (100));
- Staff_sidify (text_p_).set_axis (Y_AXIS);
+ Side_position_interface (text_p_).set_axis (Y_AXIS);
if (absd->get_direction ())
new_cresc_p = new Crescendo;
new_cresc_p->grow_dir_ = (span_l->span_type_str_ == "crescendo") ? BIGGER : SMALLER;
- Staff_sidify (new_cresc_p).set_axis (Y_AXIS);
+ Side_position_interface (new_cresc_p).set_axis (Y_AXIS);
announce_element (Score_element_info (new_cresc_p, span_l));
}
}
)
{
if (text_p_)
- Staff_sidify (text_p_).add_support (i.elem_l_);
+ Side_position_interface (text_p_).add_support (i.elem_l_);
if (to_end_cresc_p_)
- Staff_sidify (to_end_cresc_p_).add_support (i.elem_l_);
+ Side_position_interface (to_end_cresc_p_).add_support (i.elem_l_);
if (cresc_p_)
- Staff_sidify(cresc_p_).add_support (i.elem_l_);
+ Side_position_interface(cresc_p_).add_support (i.elem_l_);
}
}
class Local_key_item : public Note_head_side, public Staff_symbol_referencer {
Array<Local_key_cautionary_tuple> accidental_arr_;
- Molecule accidental (int,bool) const;
+ Molecule accidental (int,bool,bool) const;
public:
int c0_position_i_;
Local_key_item ();
#define NOTE_HEAD_SIDE_HH
#include "item.hh"
+#include "directional-element.hh"
/**
be next to noteheads.
UGH. another reduplication of Staff_side
*/
-class Note_head_side: public virtual Item
+class Note_head_side: public virtual Item, public virtual Directional_element
{
- Link_array<Item> support_l_arr_;
public:
- // naming to avoid conflict with Align_element
- Direction notehead_align_dir_;
Note_head_side ();
bool supported_b () const;
void add_support (Item*);
VIRTUAL_COPY_CONS (Score_element);
-protected:
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
- virtual void do_pre_processing();
};
#include "staff-symbol-referencer.hh"
#include "directional-element.hh"
-struct Staff_sidify
+struct Side_position_interface
{
Score_element * elt_l_;
public:
- Staff_sidify (Score_element*);
- static Real position_self (Dimension_cache const *);
-
+ Side_position_interface (Score_element*);
+ static Real side_position (Dimension_cache const *);
+ static Real self_alignment (Dimension_cache const *);
+ static Real aligned_side (Dimension_cache const *);
+
void set_axis (Axis);
Axis get_axis () const;
- bool is_staff_side_b ();
+ bool supported_b () const;
+ bool is_staff_side_b () const;
void add_support (Score_element*);
- Real aligned_position (Dimension_cache const*);
-
Direction get_direction () const;
void set_direction (Direction);
}
Molecule
-Local_key_item::accidental (int j, bool cautionary) const
+Local_key_item::accidental (int j, bool cautionary, bool natural) const
{
Molecule m (lookup_l ()->afm_find (String ("accidentals-") + to_str (j)));
+ if (natural)
+ {
+ Molecule prefix = lookup_l ()->afm_find (String ("accidentals-0"));
+ m.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0);
+ }
if (cautionary)
{
Molecule open = lookup_l ()->afm_find (String ("accidentals-("));
(c0_position_i_ + p.notename_i_)
* note_distance;
- Molecule m (accidental (p.accidental_i_, accidental_arr_[i].cautionary_b_));
+ Molecule m (accidental (p.accidental_i_,
+ accidental_arr_[i].cautionary_b_,
+ accidental_arr_[i].natural_b_));
m.translate_axis (dy, Y_AXIS);
octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0);
*/
+#include "staff-side.hh"
#include "note-head-side.hh"
-
void
Note_head_side::add_support (Item*head_l)
{
- if (support_l_arr_.find_l(head_l))
- return ;
- support_l_arr_.push (head_l);
+ Side_position_interface s (this);
+ s.add_support (head_l);
add_dependency (head_l);
}
-void
-Note_head_side::do_pre_processing ()
-{
- Interval x_int;
- for (int i=0; i < support_l_arr_.size(); i++)
- {
- Graphical_element *common =
- common_refpoint (support_l_arr_[i], X_AXIS);
- Real x = support_l_arr_[i]->relative_coordinate (common, X_AXIS)
- - relative_coordinate (common, X_AXIS);
-
- x_int.unite (x + support_l_arr_[i]->extent (X_AXIS));
- }
-
- if (x_int.empty_b ())
- x_int = Interval(0,0);
-
- translate_axis (-extent(X_AXIS)[-notehead_align_dir_] + x_int[notehead_align_dir_], X_AXIS);
-}
-void
-Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n)
+Note_head_side::Note_head_side()
{
- if (Item* o_l = dynamic_cast <Item *> (o))
- support_l_arr_.substitute (o_l,dynamic_cast <Item *> (n));
+ Side_position_interface s(this);
+ s.set_axis (X_AXIS);
+ s.set_direction (LEFT);
}
-Note_head_side:: Note_head_side()
-{
- notehead_align_dir_ = LEFT;
-}
bool
Note_head_side::supported_b ()const
{
- return support_l_arr_.size ();
+ Side_position_interface s(this);
+ return s.supported_b ();
}
#include "misc.hh"
#include "paper-outputter.hh"
#include "dimension-cache.hh"
-
+#include "staff-side.hh"
Interval
Score_element::dim_cache_callback (Dimension_cache const*c)
}
-
-Real
-set_alignment_callback (Dimension_cache const *c)
-{
- String s ("self-alignment-");
- Axis ax = c->axis ();
- s += (ax == X_AXIS) ? "X" : "Y";
- Score_element *elm = dynamic_cast<Score_element*> (c->element_l ());
- SCM align (elm->get_elt_property (s));
- if (isdir_b (align))
- {
- Direction d = to_dir (align);
- Interval ext(elm->extent (ax));
- if (d)
- {
- return - ext[d];
- }
- return - ext.center ();
- }
- else
- return 0.0;
-}
-
-
Score_element::Score_element()
{
output_p_ =0;
return;
status_i_ ++;
- if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED)
+ /*
+ UGH. UGH. UGH.
+ */
+ if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED
+ && !dim_cache_[X_AXIS]->off_callback_l_)
{
- dim_cache_[X_AXIS]->set_offset_callback (set_alignment_callback);
+ dim_cache_[X_AXIS]->set_offset_callback (Side_position_interface::self_alignment);
}
- if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED)
+ if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED
+ && !dim_cache_[X_AXIS]->off_callback_l_)
+
{
- dim_cache_[Y_AXIS]->set_offset_callback (set_alignment_callback);
+ dim_cache_[Y_AXIS]->set_offset_callback (Side_position_interface::self_alignment);
}
do_add_processing();
if (SMOB_IS_TYPE_B (Score_element, s))
{
Score_element *sc = SMOB_TO_TYPE (Score_element, s);
- Score_element * br =0;
if (sc->line_l () != line)
{
- br = sc->find_broken_piece (line);
+ sc= sc->find_broken_piece (line);
}
- if (br)
- return br->self_scm_;
+ return sc ? sc->self_scm_ : SCM_UNDEFINED;
}
else if (gh_pair_p (s))
{
if (!thing)
return;
- if (Staff_sidify (thing).is_staff_side_b ())
+ if (Side_position_interface (thing).is_staff_side_b ())
{
- if (!thing->breakable_b () && Staff_sidify (thing).get_axis () == Y_AXIS)
+ if (!thing->breakable_b () && Side_position_interface (thing).get_axis () == Y_AXIS)
{
script_l_arr_.push (thing);
}
for (int i=0; i < staff_sided_item_l_arr_.size (); i++)
{
- Staff_sidify st (staff_sided_item_l_arr_[i]);
+ Side_position_interface st (staff_sided_item_l_arr_[i]);
arrs[st.get_direction ()].push (staff_sided_item_l_arr_[i]);
}
Item * last = 0;
for (int i=0; i < arr.size (); i++)
{
- Staff_sidify s (arr[i]);
+ Side_position_interface s (arr[i]);
if (last)
{
s.add_support (last);
continue;
}
Script *p =new Script;
- Staff_sidify stafy (p);
+ Side_position_interface stafy (p);
list = gh_cdr (list);
p->set_elt_property ("molecule",
{
for (int i=0; i < script_p_arr_.size(); i++)
{
- Staff_sidify stafy (script_p_arr_[i]);
+ Side_position_interface stafy (script_p_arr_[i]);
stafy.elt_l_->set_elt_property ("direction-source", s->self_scm_);
stafy.add_support (s);
}
{
for (int i=0; i < script_p_arr_.size(); i++)
{
- Staff_sidify stafy(script_p_arr_[i]);
+ Side_position_interface stafy(script_p_arr_[i]);
if (!stafy.elt_l_->parent_l (X_AXIS))
{
void
Script::do_post_processing ()
{
- Direction d = Staff_sidify (this).get_direction ();
+ Direction d = Side_position_interface (this).get_direction ();
Molecule m (get_molecule(d));
/*
#include "dimensions.hh"
#include "dimension-cache.hh"
-Staff_sidify::Staff_sidify (Score_element *e)
+Side_position_interface::Side_position_interface (Score_element *e)
{
elt_l_ = e;
}
void
-Staff_sidify::add_support (Score_element*e)
+Side_position_interface::add_support (Score_element*e)
{
SCM sup = elt_l_->get_elt_property ("side-support");
elt_l_->set_elt_property ("side-support",
gh_cons (e->self_scm_,sup));
}
-Real
-Staff_sidify::aligned_position (Dimension_cache const *c)
-{
- return position_self (c);
-}
Direction
-Staff_sidify::get_direction () const
+Side_position_interface::get_direction () const
{
SCM d = elt_l_->get_elt_property ("direction");
if (isdir_b (d))
{
Score_element * e = SMOB_TO_TYPE(Score_element,other_elt);
- return relative_dir * Staff_sidify (e).get_direction ();
+ return relative_dir * Side_position_interface (e).get_direction ();
}
return DOWN;
Callback that does the aligning.
*/
Real
-Staff_sidify::position_self (Dimension_cache const * c)
+Side_position_interface::side_position (Dimension_cache const * c)
{
Score_element * me = dynamic_cast<Score_element*> (c->element_l ());
SCM support = me->get_elt_property ("side-support");
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- assert (SMOB_IS_TYPE_B (Score_element, gh_car (s)));
+ if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
+ continue;
+
Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
common = common->common_refpoint (e, axis);
}
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
+ if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
+ continue;
+
Score_element * e = SMOB_TO_TYPE(Score_element, gh_car (s));
Real coord = e->relative_coordinate (common, axis);
Real off = me->parent_l (axis)->relative_coordinate (common, axis);
- Direction dir = Staff_sidify (me).get_direction ();
+ Direction dir = Side_position_interface (me).get_direction ();
SCM pad = me->remove_elt_property ("padding");
if (pad != SCM_UNDEFINED)
return total_off;
}
+Real
+Side_position_interface::self_alignment (Dimension_cache const *c)
+{
+ String s ("self-alignment-");
+ Axis ax = c->axis ();
+ s += (ax == X_AXIS) ? "X" : "Y";
+ Score_element *elm = dynamic_cast<Score_element*> (c->element_l ());
+ SCM align (elm->get_elt_property (s));
+ if (isdir_b (align))
+ {
+ Direction d = to_dir (align);
+ Interval ext(elm->extent (ax));
+ if (d)
+ {
+ return - ext[d];
+ }
+ return - ext.center ();
+ }
+ else
+ return 0.0;
+}
+
+
+Real
+Side_position_interface::aligned_side (Dimension_cache const *c)
+{
+ Score_element * me = dynamic_cast<Score_element*> (c->element_l ());
+ Side_position_interface s(me);
+ Direction d = s.get_direction ();
+ Axis ax = s.get_axis ();
+ Real o = side_position (c);
+
+ Interval iv = me->extent (ax);
+
+ if (!iv.empty_b ())
+ {
+ o += - iv[-d];
+
+ SCM pad = me->get_elt_property ("padding");
+ if (gh_number_p (pad))
+ o += d *gh_scm2double (pad) ;
+ }
+ return o;
+}
+
+
void
-Staff_sidify::set_axis (Axis a)
+Side_position_interface::set_axis (Axis a)
{
- if (elt_l_->get_elt_property ("transparent") == SCM_UNDEFINED)
+ // prop transparent ?
+ if (elt_l_->get_elt_property ("side-support") == SCM_UNDEFINED)
elt_l_->set_elt_property ("side-support" ,SCM_EOL);
Axis other = Axis ((a +1)%2);
- elt_l_->dim_cache_[a]->set_offset_callback (position_self);
+ elt_l_->dim_cache_[a]->set_offset_callback (aligned_side);
elt_l_->dim_cache_[other]->set_offset_callback (0);
}
+
Axis
-Staff_sidify::get_axis () const
+Side_position_interface::get_axis () const
{
- if (elt_l_->dim_cache_[X_AXIS]->off_callback_l_ == position_self) // UGH.
+ Offset_cache_callback c = elt_l_->dim_cache_[X_AXIS]->off_callback_l_ ;
+ if (c == side_position
+ || c == aligned_side
+ ) // UGH.
return X_AXIS;
else
return Y_AXIS;
}
void
-Staff_sidify::set_direction (Direction d)
+Side_position_interface::set_direction (Direction d)
{
elt_l_->set_elt_property ("direction", gh_int2scm (d));
}
bool
-Staff_sidify::is_staff_side_b ()
+Side_position_interface::is_staff_side_b () const
{
return elt_l_->get_elt_property ("side-support") != SCM_UNDEFINED;
}
+
+bool
+Side_position_interface::supported_b () const
+{
+ return elt_l_->get_elt_property ("side-support") != SCM_EOL;
+}
{
for (int i=0; i < texts_.size (); i++)
{
- Staff_sidify st (texts_[i]);
+ Side_position_interface st (texts_[i]);
st.add_support (n);
if (st.get_axis( ) == X_AXIS
&& !texts_[i]->parent_l (Y_AXIS))
{
for (int i=0; i < texts_.size (); i++)
{
- Staff_sidify st(texts_[i]);
+ Side_position_interface st(texts_[i]);
st.add_support (n);
}
}
Text_script_req * r = reqs_[i];
Text_item *text = new Text_item;
- Staff_sidify stafy (text);
+ Side_position_interface stafy (text);
SCM axisprop = get_property ("scriptHorizontal",0);
if (gh_boolean_p (axisprop) && gh_scm2bool (axisprop))