the two systems for y dimensions (1 unit = staffspace, 1 unit = 1
point) are mixed.
+\section{Grace notes}
+
+Grace notes are typeset as an encapsulated piece of music. You can
+have beams, notes, chords, stems etc. within a \verb|\grace|
+section. Slurs that start within a grace section, but aren't ended are
+attached to the next normal note. Grace notes have zero duration
+
+\mudelafile{grace.ly}
+
\section{Beams, slurs and other spanners}
\mudelafile{repeat-unfold.ly}
-Semi (un)0folded behavior:
+Semi (un)folded behavior:
\mudelafile{repeat-semifold.ly}
+Folded. This doesn't make sense without alternatives, but it works.
+
+\mudelafile{repeat-fold.ly}
+
\section{Multiple notes}
Rests should not collide with beams, stems and noteheads. Rests may
and whole rests just outside the staff get ledger lines in different
cases.
-
\mudelafile{rest-collision.ly}
Normal collisions. We have support for four voice polyphony, where the
global spacing -- only if space gets tight, notes are shifted to make
room for the breathing sign. Breathing signs break beams running
through their voice. In the following example, the notes in the first
-two bars all have the same distance from each other:
+two measures all have the same distance from each other:
\mudelafile{breathing-sign.ly}
. * ps/lily.ps see comments.
. * didot / big point.
. * midi key.
-. * Repeats
-. * input/bugs/rep.ly (moved from test)
-. * unfold broken:
-. * without alternatives: repeat unfold 4 { a b c d }
-. * count > alternatives: repeat unfold 79 { a b c d }
-\alternative { { c c c c } { d d d d } }
-. * kind of 'initial property' iso fold/volta(semi)/unfold strings
. * fix singleStaffBracket
. * declare performers in \midi
. * input/test/stem-spacing.ly: 12/4 touches first note
-4 too high?
+. * timesig: sometimes bottom digit too high
. * fix MIDI
. * \shape 1st dim skipped?
. * turn slope-damping on/off
. * We need feta-din*.mf files for more sizes than 10.
. * fix dynamics decently, ie. use kerning & ligatures.
-. *
-BUGS:
-> +
-> + Causes segfault:
-> +
-> + \score{
-> + \notes{ \context Voice {
-> + \repeat fold 2 { a b c d } {}
-> + }
-> + }
-> + }
-> +
. * dots & rest collisions?
. * mudela-book.py
. * fix \mudelafile{} to have decent functionality
this fragment is floating eps, than 1, otherwise 2). say
preMudelaExample[eps]{}, and change it in document body sometimes.
. * use less RE's
-. * slurs colllide with lyrics.
. * junk _ in lyric mode for " "
. * Lyrics and scripts collide.
. * a note with a circle after it, meaning:
page three, the c-sharp on the second line should be a quarter with
a circle, not a quarter tied to a sixteenth. is this at all
possible with lily?
+. * grace_align_item -> stackingdir = left, weird placement.
. * tuplets that are written as "number : note", for example
"3 : [image of a half note here]". possible?
. * heavier beams?
.* Cleanups needed
-. * \$ and $ identifier syntax.
+. * \$ and $ identifier syntax in examples.
. * Y dimension units: staffspace vs. Point
. * Beam
. * Stem
+. * Rhythmic_column and interaction stem/rhythmic_column/note_head/dots.
. * Slur
. * Rhythmic_grouping
. * Duration
. * account for rhythmic position in measure
. * etc.
-. * grace notes
-. * make separate class for Grace_*_engravers
- (which is at Voice_gravs level)
-. * make encapsulated spacing problems.
-
. * accidentals per Voice_group
. * Output class, handles : (smallish)
Rational ();
Rational (int, int =1);
Rational (double);
- Rational (Rational const&);
+ Rational (Rational const&r) { copy (r);}
Rational &operator = (Rational const &);
Rational &operator *= (Rational);
normalise ();
}
-Rational::Rational (Rational const &r)
-{
- copy (r);
-}
-
static
int gcd (int a, int b)
{
--- /dev/null
+
+\score {\notes {
+ c2.
+ c1
+ \grace { [c32 d] }
+
+
+
+}}
-\version "1.0.21";
-
-\score{
- <
- \context Staff = a \notes\relative c <
-% {\grace b''8 \graceat a4 \ecarg g fis2 | a2 a }
- {\tiny b''8*1/16 \normalsize a4*31/32 g fis2 | a2 a }
- >
- \context Staff = b \notes\relative c <
-% {\grace g''16 b16 \graceat a4 \ecarg g fis2 | }
- {\tiny g''16*1/16 b16*1/16 \normalsize a4*31/32 g fis2 | a1 }
- >
- \context Staff = c \notes\relative c <
-% {\grace \times 2/48 { [ g''16 b g] } \graceat a4 \ecarg g fis2 | a1 }
- {\tiny \times 2/48 { [ g''16 b g] } \normalsize a4*31/32 g fis2 | a1 }
- >
- >
- \paper {
- linewidth = 120.0\mm;
- \translator { \VoiceContext }
- }
+\score {\notes \context Voice = VA \relative c'' {
+ \grace c8 c4
+ \grace { [c32 c32] } c4
+ \grace { [b32 ( c32] } c4
+ \grace c16 [c8 c8]
+}
}
-
--- /dev/null
+
+\score { \notes\context Staff\relative c'' {
+\repeat fold 3 { c^"3$\\times$ 0alt" d }
+% less alts than body
+\repeat fold 4 { c^"4$\\times$ 2alt" d } \alternative { e f }
+% more alts than body
+\repeat fold 2 { c^"2$\\times$ 3alt" d } \alternative { e f g }
+}}
+
--- /dev/null
+/*
+ align-note-column-engraver.cc -- implement Align_note_column_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "engraver.hh"
+#include "grace-align-item.hh"
+#include "note-column.hh"
+
+/**
+ catch notes, and put them in a row.
+ */
+class Align_note_column_engraver: public Engraver
+{
+ Axis_align_item * align_item_p_;
+ virtual void do_creation_processing ();
+ virtual void do_removal_processing ();
+ virtual void acknowledge_element (Score_element_info);
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Align_note_column_engraver ();
+};
+
+Align_note_column_engraver::Align_note_column_engraver()
+{
+ align_item_p_ =0;
+}
+
+void
+Align_note_column_engraver::do_creation_processing ()
+{
+ align_item_p_ = new Grace_align_item;
+ // needed for setting font size.
+ announce_element (Score_element_info (align_item_p_, 0));
+}
+
+void
+Align_note_column_engraver::do_removal_processing ()
+{
+ typeset_element (align_item_p_);
+ align_item_p_ =0;
+}
+
+void
+Align_note_column_engraver::acknowledge_element (Score_element_info inf)
+{
+ if (Note_column * n = dynamic_cast<Note_column*> (inf.elem_l_))
+ {
+ align_item_p_->add_element (n);
+ }
+}
+
+ADD_THIS_TRANSLATOR(Align_note_column_engraver);
#include "multi-measure-rest.hh"
#include "command-request.hh"
#include "time-description.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
Bar_engraver::Bar_engraver()
{
#include "bar-number-engraver.hh"
#include "time-description.hh"
#include "timing-engraver.hh"
-#include "engraver-group.hh"
-#include "g-text-item.hh"
+#include "engraver-group-engraver.hh"
+#include "text-item.hh"
Bar_number_engraver::Bar_number_engraver()
{
#include "bar-script-engraver.hh"
#include "bar.hh"
#include "clef-item.hh"
-#include "g-staff-side.hh"
-#include "g-text-item.hh"
+#include "staff-side.hh"
+#include "text-item.hh"
#include "lily-guile.hh"
#include "p-col.hh"
#include "paper-def.hh"
if (staff_side_p_ || text_p_)
return;
- staff_side_p_ = new G_staff_side_item;
+ staff_side_p_ = new Staff_side_item;
staff_side_p_->axis_ = axis_;
staff_side_p_->set_elt_property (breakable_scm_sym, SCM_BOOL_T); // ugh
- text_p_ = new G_text_item;
+ text_p_ = new Text_item;
text_p_->set_elt_property (breakable_scm_sym, SCM_BOOL_T); // ugh
Scalar prop = get_property (type_ + "Direction", 0);
void
Beam_engraver::acknowledge_element (Score_element_info info)
{
- if (beam_p_)
- {
- Stem* stem_l = dynamic_cast<Stem *> (info.elem_l_);
- if (!stem_l)
- return;
+ if (beam_p_)
+ {
+ Stem* stem_l = dynamic_cast<Stem *> (info.elem_l_);
+ if (!stem_l || stem_l->beam_l_)
+ return;
+ bool self_grace = beam_p_->get_elt_property (grace_scm_sym) != SCM_BOOL_F;
+ bool stem_grace = stem_l->get_elt_property (grace_scm_sym) != SCM_BOOL_F;
- Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
- if (!rhythmic_req)
- {
- String s = _ ("Stem must have Rhythmic structure.");
- if (info.req_l_)
- info.req_l_->warning (s);
- else
- ::warning (s);
+ if (!self_grace && stem_grace)
+ return;
+
+ Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
+ if (!rhythmic_req)
+ {
+ String s = _ ("Stem must have Rhythmic structure.");
+ if (info.req_l_)
+ info.req_l_->warning (s);
+ else
+ ::warning (s);
- return;
- }
+ return;
+ }
- if (rhythmic_req->duration_.durlog_i_<= 2)
- {
- rhythmic_req->warning (_ ("stem doesn't fit in beam"));
- prev_start_req_->warning (_ ("beam was started here"));
- return;
- }
-
- /*
- TODO: do something sensible if it doesn't fit in the beam.
- */
- Moment start = get_staff_info().time_C_->whole_in_measure_;
-
- if (!grouping_p_->child_fit_b (start))
- {
- String s (_ ("please fix me") + ": "
- + _f ("stem at %s doesn't fit in beam", now_mom ().str ()));
-
- if (info.req_l_)
- info.req_l_->warning(s);
- else
- warning (s);
- }
- else
- {
- grouping_p_->add_child (start, rhythmic_req->length_mom ());
- stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
- beam_p_->add_stem (stem_l);
- }
- }
+ if (rhythmic_req->duration_.durlog_i_<= 2)
+ {
+ rhythmic_req->warning (_ ("stem doesn't fit in beam"));
+ prev_start_req_->warning (_ ("beam was started here"));
+ return;
+ }
+
+ /*
+ TODO: do something sensible if it doesn't fit in the beam.
+ */
+ Moment start = get_staff_info().time_C_->whole_in_measure_;
+
+ if (!grouping_p_->child_fit_b (start))
+ {
+ String s (_ ("please fix me") + ": "
+ + _f ("stem at %s doesn't fit in beam", now_mom ().str ()));
+
+ if (info.req_l_)
+ info.req_l_->warning(s);
+ else
+ warning (s);
+ }
+ else
+ {
+ grouping_p_->add_child (start, rhythmic_req->length_mom ());
+ stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
+ beam_p_->add_stem (stem_l);
+ }
+ }
}
total_count_i++;
}
- Real internote_f = stems_[0]->staff_line_leading_f ()/2;
int stem_max = (int)rint(paper_l ()->get_var ("stem_max"));
Real shorten_f = paper_l ()->get_var (String ("forced_stem_shorten"
- + to_str (multiple_i_ <? stem_max)))
- / internote_f;
+ + to_str (multiple_i_ <? stem_max)));
Real leftx = 0;
for (int i=0; i < stems_.size (); i++)
#include "breathing-sign.hh"
#include "musical-request.hh"
#include "command-request.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "note-head.hh"
#include "local-key-item.hh"
#include "paper-def.hh"
#include "main.hh"
#include "dimensions.hh"
-#include "g-text-item.hh"
+#include "text-item.hh"
ADD_THIS_TRANSLATOR (Chord_name_engraver);
}
}
- G_text_item* item_p = new G_text_item;
+ Text_item* item_p = new Text_item;
/*
TODO:
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
-#include "g-text-item.hh"
+#include "text-item.hh"
#include "p-score.hh"
void
{
if (!break_status_dir ()) // broken stuff takes care of their own texts
{
- G_text_item *g =0;
+ Text_item *g =0;
SCM octave_dir = remove_elt_property (octave_dir_scm_sym);
if (octave_dir != SCM_BOOL_F)
{
Direction d = Direction (gh_scm2int (SCM_CDR(octave_dir)));
- g = new G_text_item;
+ g = new Text_item;
pscore_l_->typeset_element (g);
g->text_str_ = "8";
{
if (Note_column * c = dynamic_cast<Note_column *> (i.elem_l_))
{
- if (c->rest_b ())
+ if (c->rest_b () || c->dim_cache_[X_AXIS]->parent_l_
+ || c->dim_cache_[X_AXIS]->parent_l_)
return ;
note_column_l_arr_.push (c);
#include "score-column.hh"
#include "staff-symbol.hh"
#include "note-column.hh"
-#include "g-text-item.hh"
-#include "g-staff-side.hh"
+#include "text-item.hh"
+#include "staff-side.hh"
#include "engraver.hh"
#include "stem.hh"
#include "note-head.hh"
*/
class Dynamic_engraver : public Engraver
{
- G_text_item * text_p_;
- G_staff_side_item * staff_side_p_;
- G_staff_side_spanner * ss_span_p_;
- G_staff_side_spanner * to_end_ss_span_p_;
+ Text_item * text_p_;
+ Staff_side_item * staff_side_p_;
+ Staff_side_spanner * ss_span_p_;
+ Staff_side_spanner * to_end_ss_span_p_;
Crescendo * to_end_cresc_p_;
Dynamic_engraver::do_process_requests()
{
Crescendo* new_cresc_p=0;
- G_staff_side_spanner * new_sss_p =0;
+ Staff_side_spanner * new_sss_p =0;
for (int i=0; i < dynamic_req_l_arr_.size(); i++)
{
if (Text_script_req *absd =
String loud = absd->text_str_;
- text_p_ = new G_text_item;
+ text_p_ = new Text_item;
text_p_->text_str_ = loud; // ugh
Scalar prop = get_property ("dynamicStyle", 0);
text_p_->style_str_ = prop.length_i () ? prop : "dynamic";
- staff_side_p_ = new G_staff_side_item;
+ staff_side_p_ = new Staff_side_item;
staff_side_p_->set_elt_property (script_priority_scm_sym,
gh_int2scm (100));
new_cresc_p->grow_dir_ = (span_l->span_type_str_ == "crescendo") ? BIGGER : SMALLER;
announce_element (Score_element_info (new_cresc_p, span_l));
- new_sss_p = new G_staff_side_spanner;
+ new_sss_p = new Staff_side_spanner;
new_sss_p->set_victim (new_cresc_p);
new_sss_p->axis_ = Y_AXIS;
announce_element (Score_element_info (new_sss_p, span_l));
*/
#include "proto.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "engraver.hh"
#include "debug.hh"
#include "p-score.hh"
#include "music-list.hh"
#include "musical-request.hh"
#include "engraver.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "extender-engraver.hh"
#include "extender-spanner.hh"
#include "score-column.hh"
-#include "g-text-item.hh"
+#include "text-item.hh"
ADD_THIS_TRANSLATOR (Extender_engraver);
void
Extender_engraver::acknowledge_element (Score_element_info i)
{
- if (G_text_item* t = dynamic_cast<G_text_item*> (i.elem_l_))
+ if (Text_item* t = dynamic_cast<Text_item*> (i.elem_l_))
{
Rhythmic_req * rh = dynamic_cast<Rhythmic_req*> (i.req_l_);
if (!rh)
end_ = 0;
}
-Text_lyric_tuple::Text_lyric_tuple (G_text_item *h, Rhythmic_req*m, Moment mom)
+Text_lyric_tuple::Text_lyric_tuple (Text_item *h, Rhythmic_req*m, Moment mom)
{
text_l_ = h;
req_l_ = m;
void
Font_size_engraver::acknowledge_element (Score_element_info e)
{
- if (size_i_)
- e.elem_l_->set_elt_property (fontsize_scm_sym,
- gh_int2scm (size_i_));
+ if (size_i_ && e.elem_l_->get_elt_property (fontsize_scm_sym) == SCM_BOOL_F)
+ {
+ e.elem_l_->set_elt_property (fontsize_scm_sym,
+ gh_int2scm (size_i_));
+ }
}
-
ADD_THIS_TRANSLATOR (Font_size_engraver);
*/
#include "global-translator.hh"
+#include "music-iterator.hh"
+#include "debug.hh"
Global_translator::Global_translator()
{
{
return 0;
}
+
+void
+Global_translator::process ()
+{
+}
+void
+Global_translator::start ()
+{
+}
+void
+Global_translator::finish ()
+{
+}
+
+void
+Global_translator::run_iterator_on_me (Music_iterator * iter)
+{
+ while (iter->ok() || moments_left_i ())
+ {
+ Moment w;
+ w.set_infinite (1);
+ if (iter->ok())
+ {
+ w = iter->next_moment();
+ DOUT << "proccing: " << w << '\n';
+ if (!monitor->silent_b ("walking"))
+ iter->print();
+ }
+
+ modify_next (w);
+ prepare (w);
+
+ if (!monitor->silent_b ("walking"))
+ print();
+
+ iter->process_and_next (w);
+ process();
+ }
+}
--- /dev/null
+/*
+ grace-align-item.cc -- implement Grace_align_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "grace-align-item.hh"
+#include "lookup.hh"
+
+Grace_align_item::Grace_align_item ()
+{
+ stacking_dir_ = RIGHT;
+ set_axis (X_AXIS);
+}
+
+void
+Grace_align_item::do_pre_processing ()
+{
+ Real nhw = lookup_l ()->notehead (2, "").dim_[X_AXIS].length();
+ threshold_interval_[MIN] = nhw* 1.5;
+
+ Axis_align_item::do_pre_processing ();
+ Note_head_side::do_pre_processing ();
+
+ translate_axis (-0.5* nhw, X_AXIS); // ugh.
+}
+
+void
+Grace_align_item::do_substitute_element_pointer (Score_element*o, Score_element*n)
+{
+ Axis_align_item::do_substitute_element_pointer (o,n);
+ Note_head_side::do_substitute_element_pointer( o,n);
+}
--- /dev/null
+/*
+ grace-engraver-group.cc -- implement Grace_engraver_group
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "grace-engraver-group.hh"
+#include "lily-guile.hh"
+#include "ly-symbols.hh"
+#include "score-element.hh"
+
+void
+Grace_engraver_group::start ()
+{
+}
+/*
+ We're really finished with this context. Get rid of everything.
+ */
+void
+Grace_engraver_group::finish ()
+{
+ calling_self_b_ = true;
+ removal_processing (); // ugr. We'd want to have this done by our parents.g
+ for (int i=0; i < announce_to_top_.size (); i++)
+ {
+ Engraver::announce_element (announce_to_top_[i]);
+ }
+
+ for (int i=0; i < typeset_us_.size (); i++)
+ {
+ Engraver::typeset_element (typeset_us_[i]);
+ }
+ typeset_us_.clear ();
+ calling_self_b_ = false;
+}
+
+void
+Grace_engraver_group::do_removal_processing ()
+{
+ Engraver_group_engraver::do_removal_processing ();
+}
+
+void
+Grace_engraver_group::announce_element (Score_element_info inf)
+{
+ announce_info_arr_.push (inf);
+ // do not propagate to top
+ announce_to_top_.push (inf);
+
+ inf.elem_l_->set_elt_property (grace_scm_sym, SCM_BOOL_T);
+}
+
+void
+Grace_engraver_group::typeset_element (Score_element*e)
+{
+ typeset_us_.push (e);
+}
+
+
+Grace_engraver_group::Grace_engraver_group()
+{
+ calling_self_b_ = false;
+}
+
+void
+Grace_engraver_group::process ()
+{
+ calling_self_b_ = true;
+ process_requests ();
+ do_announces();
+ pre_move_processing();
+ check_removal();
+ calling_self_b_ = false;
+}
+
+
+void
+Grace_engraver_group::each (Method_pointer method)
+{
+ if (calling_self_b_)
+ Engraver_group_engraver::each (method);
+}
+
+
+void
+Grace_engraver_group::each (Const_method_pointer method) const
+{
+ if (calling_self_b_)
+ Engraver_group_engraver::each (method);
+}
+ADD_THIS_TRANSLATOR(Grace_engraver_group);
+
+
+/*
+ don't let the commands trickle up.
+ */
+bool
+Grace_engraver_group::do_try_music (Music *m)
+{
+ bool hebbes_b =false;
+
+ Link_array<Translator> nongroups (nongroup_l_arr ());
+
+ for (int i =0; !hebbes_b && i < nongroups.size() ; i++)
+ hebbes_b =nongroups[i]->try_music (m);
+
+ return hebbes_b;
+}
--- /dev/null
+/*
+ grace-iterator.cc -- implement Grace_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "grace-iterator.hh"
+#include "global-translator.hh"
+#include "warn.hh"
+
+void
+Grace_iterator::construct_children ()
+{
+ Translator_group * t = report_to_l ()->find_create_translator_l ("Grace", ""); // umgh.
+
+ if (t)
+ set_translator (t);
+ Music_wrapper_iterator::construct_children ();
+}
+
+void
+Grace_iterator::do_process_and_next (Moment m)
+{
+ Global_translator * t = dynamic_cast<Global_translator*>(report_to_l ());
+ if (t)
+ {
+ t->start ();
+ t->run_iterator_on_me (child_iter_p_);
+ delete child_iter_p_;
+ child_iter_p_ = 0;
+ t->finish ();
+ Music_iterator::do_process_and_next (m);
+ }
+ else
+ {
+ warning (_("No Grace context available!"));
+ }
+}
+
+Moment
+Grace_iterator::next_moment () const
+{
+ return 0;
+}
--- /dev/null
+/*
+ grace-music.cc -- implement Grace_music
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "grace-music.hh"
+
+void
+Grace_music::compress (Moment)
+{
+
+}
+
+Moment
+Grace_music::length_mom () const
+{
+ return 0;
+}
+
+Grace_music::Grace_music (Music *p)
+ : Music_wrapper (p)
+{
+}
--- /dev/null
+/*
+ grace-position-engraver.cc -- implement Grace_position_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "engraver.hh"
+#include "grace-align-item.hh"
+#include "note-head.hh"
+#include "local-key-item.hh"
+
+class Grace_position_engraver:public Engraver
+{
+protected:
+ VIRTUAL_COPY_CONS(Translator);
+ virtual void acknowledge_element (Score_element_info);
+ virtual void process_acknowledged ();
+ virtual void do_post_move_processing ();
+ Grace_align_item*align_l_;
+ Link_array<Item> support_;
+public:
+ Grace_position_engraver();
+};
+
+
+Grace_position_engraver::Grace_position_engraver ()
+{
+ align_l_ =0;
+}
+
+void
+Grace_position_engraver::acknowledge_element (Score_element_info i)
+{
+ if (Grace_align_item*g =dynamic_cast<Grace_align_item*>(i.elem_l_))
+ {
+ align_l_ = g;
+ }
+ else if (Note_head * n = dynamic_cast <Note_head*> (i.elem_l_))
+ {
+ support_.push (n);
+ }
+ else if (Local_key_item*it = dynamic_cast<Local_key_item*>(i.elem_l_))
+ {
+ support_.push (it);
+ }
+}
+
+void
+Grace_position_engraver::process_acknowledged ()
+{
+ if (align_l_)
+ {
+ for (int i=0; i < support_.size (); i++)
+ align_l_->add_support (support_[i]);
+ support_.clear ();
+ }
+}
+
+void
+Grace_position_engraver::do_post_move_processing ()
+{
+ support_.clear ();
+ align_l_ =0;
+}
+
+ADD_THIS_TRANSLATOR(Grace_position_engraver);
class Bar_script_engraver : public Engraver
{
protected:
- G_staff_side_item* staff_side_p_;
- G_text_item* text_p_;
+ Staff_side_item* staff_side_p_;
+ Text_item* text_p_;
Protected_scm visibility_lambda_;
String type_;
Axis axis_;
--- /dev/null
+
+/*
+ engraver-group-engraver.hh -- declare Engraver_group_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef ENGRAVERGROUP_HH
+#define ENGRAVERGROUP_HH
+
+#include "lily-proto.hh"
+#include "parray.hh"
+#include "score-element-info.hh"
+#include "engraver.hh"
+#include "translator-group.hh"
+
+
+/**
+ Group a number of engravers. Usually delegates everything to its contents.
+ Postfix: group
+ */
+class Engraver_group_engraver : public Engraver,
+ public virtual Translator_group
+{
+protected:
+ Array<Score_element_info> announce_info_arr_;
+public:
+ VIRTUAL_COPY_CONS(Translator);
+
+ virtual Staff_info get_staff_info() const;
+ virtual void do_announces();
+ virtual void announce_element (Score_element_info);
+};
+
+#endif // ENGRAVERGROUP_HH
+
+
struct Text_lyric_tuple {
Rhythmic_req *req_l_ ;
- G_text_item *text_l_;
+ Text_item *text_l_;
Moment end_;
Text_lyric_tuple ();
- Text_lyric_tuple (G_text_item*, Rhythmic_req*, Moment);
+ Text_lyric_tuple (Text_item*, Rhythmic_req*, Moment);
static int time_compare (Text_lyric_tuple const &, Text_lyric_tuple const &);
};
Generate an extender. Should make an Extender_spanner that typesets
a nice extender line.
- We remember all G_text_items that come across, and store their
+ We remember all Text_items that come across, and store their
termination times. When we get a request, we create the spanner, and
attach the left point to the finished lyrics, and the right point to
any lyrics we receive by then.
#include "engraver.hh"
+/**
+ Set font size on elements that do not have a fontsize set yet.
+
+ Reads context property fontSize.
+
+ Writes element property fontsize
+ */
class Font_size_engraver : public Engraver {
int size_i_;
protected:
#include "rational.hh"
#include "pqueue.hh"
+
+class Iteration_interface_translator : public virtual Translator_group {
+};
+
class Global_translator : public virtual Translator_group{
PQueue<Moment> extra_mom_pq_;
public:
int moments_left_i() const;
void modify_next (Moment&);
void add_moment_to_process (Moment);
-
+ void run_iterator_on_me (Music_iterator*);
+
virtual Music_output *get_output_p ();
virtual void prepare (Moment);
- virtual void process() {}
- virtual void finish() {}
- virtual void start() {}
+ virtual void process();
+ virtual void finish();
+ virtual void start();
+
+ virtual Moment now_mom () const;
protected:
- virtual Moment now_mom () const;
- virtual Global_translator *global_l() { return this; }
+
};
--- /dev/null
+/*
+ grace-align-item.hh -- declare Grace_align_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef GRACE_ALIGN_ITEM_HH
+#define GRACE_ALIGN_ITEM_HH
+
+#include "note-head-side.hh"
+#include "axis-align-item.hh"
+
+class Grace_align_item : public Axis_align_item, public Note_head_side
+{
+public:
+ VIRTUAL_COPY_CONS (Score_element);
+ Grace_align_item ();
+protected:
+ virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+ virtual void do_pre_processing ();
+};
+#endif /* GRACE_ALIGN_ITEM_HH */
+
--- /dev/null
+/*
+ grace-engraver-group.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef GRACE_ENGRAVER_GROUP_HH
+#define GRACE_ENGRAVER_GROUP_HH
+
+#include "engraver-group-engraver.hh"
+#include "global-translator.hh"
+
+class Grace_engraver_group : public Engraver_group_engraver, public Global_translator
+{
+ Link_array<Score_element> typeset_us_;
+ Array<Score_element_info> announce_to_top_;
+ bool calling_self_b_;
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Grace_engraver_group ();
+protected:
+ virtual void announce_element (Score_element_info);
+ virtual void start ();
+ virtual void finish ();
+ virtual void process ();
+ virtual void each (Method_pointer);
+ virtual void each (Const_method_pointer) const;
+ virtual void do_removal_processing () ;
+ virtual void typeset_element (Score_element*);
+ virtual bool do_try_music (Music *m);
+};
+
+
+#endif /* GRACE_ENGRAVER_GROUP_HH */
--- /dev/null
+/*
+ grace-iterator.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef GRACE_ITERATOR_HH
+#define GRACE_ITERATOR_HH
+
+#include "music-wrapper-iterator.hh"
+
+class Grace_iterator : public Music_wrapper_iterator
+{
+public:
+ virtual void construct_children () ;
+ virtual void do_process_and_next (Moment);
+ Moment next_moment () const;
+};
+
+
+
+#endif /* GRACE_ITERATOR_HH */
+
+
--- /dev/null
+/*
+ grace-music.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef GRACE_MUSIC_HH
+#define GRACE_MUSIC_HH
+
+#include "music-wrapper.hh"
+
+class Grace_music : public Music_wrapper
+{
+public:
+ VIRTUAL_COPY_CONS(Music);
+ Grace_music (Music*);
+protected:
+ virtual void compress (Moment);
+ virtual Moment length_mom () const;
+};
+
+#endif /* GRACE_MUSIC_HH */
+
struct Axis_group_element;
struct Axis_group_spanner;
struct Axis_group_item;
+struct Axis_align_item;
struct Axis_group;
struct Bar;
struct Bar_column_engraver;
struct Engraver_group_engraver;
struct Extender;
struct Extender_req;
-struct G_script;
-struct G_script_req;
-struct G_staff_side_item;
-struct G_text_item;
+struct Script;
+struct Script_req;
+struct Staff_side_item;
+struct Text_item;
struct General_script_def;
struct Graphical_element;
struct Multi_measure_rest_req;
struct Multi_measure_rest_engraver;
struct Music;
+struct Music_iterator;
struct Musical_req;
struct Musical_span_req;
struct Musical_script_req;
struct Score_element;
struct Score_element_info;
struct Score_performer;
-struct Script;
-struct Script_column;
-struct Script_def;
-struct Script_engraver;
-struct Script_req;
struct Simple_music;
struct Simultaneous_music;
struct Single_malt_grouping_item;
#ifndef LINE_GROUP_GRAV_HH
#define LINE_GROUP_GRAV_HH
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "lily-proto.hh"
/**
- Engravers put elements on the same or lowel level in a line
+ Engravers put elements on the same or lowel level in a line.
+
+ DEPRECATED.
*/
class Line_group_engraver_group : public Engraver_group_engraver {
protected:
#include "array.hh"
#include "musical-pitch.hh"
#include "staff-symbol-referencer.hh"
+#include "note-head-side.hh"
struct Local_key_cautionary_tuple
{
figure out private/public
*/
-class Local_key_item : public Item, public Staff_symbol_referencer {
+class Local_key_item : public Note_head_side, public Staff_symbol_referencer {
Array<Local_key_cautionary_tuple> accidental_arr_;
- Link_array<Item> support_items_;
+
public:
int c0_position_i_;
Local_key_item ();
- void add_support (Item*);
void add_pitch (Musical_pitch, bool cautionary);
protected:
- virtual void do_pre_processing();
+ virtual void do_pre_processing();
virtual void do_substitute_element_pointer (Score_element*,Score_element*);
virtual Molecule* do_brew_molecule_p() const;
};
#ifndef LY_SYMBOLS_HH
#define LY_SYMBOLS_HH
+#include "lily-guile.hh"
+
#ifndef DECLARE_LY_SYMBOL
#define DECLARE_LY_SYMBOL(a) extern SCM a ## _scm_sym
#endif
DECLARE_LY_SYMBOL(extender_height);
DECLARE_LY_SYMBOL(filledbox);
DECLARE_LY_SYMBOL(fontsize);
+DECLARE_LY_SYMBOL(grace);
DECLARE_LY_SYMBOL(header);
DECLARE_LY_SYMBOL(horizontal_shift);
DECLARE_LY_SYMBOL(interbeam);
DECLARE_LY_SYMBOL(interbeam4);
DECLARE_LY_SYMBOL(interline);
+DECLARE_LY_SYMBOL(length);
DECLARE_LY_SYMBOL(linewidth);
DECLARE_LY_SYMBOL(minimum_space);
DECLARE_LY_SYMBOL(molecule);
private:
Lyric_req * req_l_;
- G_text_item* text_p_;
+ Text_item* text_p_;
};
protected:
virtual void do_print () const;
virtual void do_process_and_next (Moment) ;
-
-private:
Music_iterator *child_iter_p_;
};
};
-class Articulation_req : public G_script_req
+class Articulation_req : public Script_req
{
public:
String articulation_str_;
VIRTUAL_COPY_CONS(Music);
};
-class Text_script_req : public G_script_req {
+class Text_script_req : public Script_req {
public:
String text_str_;
--- /dev/null
+/*
+ note-head-side.hh -- declare Note_head_side
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef NOTE_HEAD_SIDE_HH
+#define NOTE_HEAD_SIDE_HH
+
+#include "item.hh"
+
+/**
+ be next to noteheads.
+
+ UGH. another reduplication of Staff_side
+ */
+class Note_head_side: public virtual Item
+{
+ Link_array<Item> support_l_arr_;
+public:
+ 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();
+};
+
+
+#endif /* NOTE_HEAD_SIDE_HH */
+
String * get_scriptdef (char c);
Request* get_script_req (char);
-Request*get_script_req (int d , Script_def*def);
Request*get_grouping_req (Array<int> i_arr);
#endif // PARSECONSTRUCT_HH
-class G_script_req : public virtual Request
+class Script_req : public virtual Request
{
public:
Direction dir_;
VIRTUAL_COPY_CONS(Music);
};
-#if 0
-/** Put a script above or below this ``note'' or bar. eg upbow, downbow. Why
- a request? These symbols may conflict with slurs and brackets, so
- this also a request */
-
-class Script_req : public virtual G_script_req {
-public:
- General_script_def *scriptdef_p_;
-
- bool do_equal_b (Request*) const;
-
- Script_req();
- VIRTUAL_COPY_CONS(Music);
- virtual void do_print () const;
- ~Script_req();
- Script_req (Script_req const&);
-};
-#endif
/**
Requests to start or stop something.
class Rhythmic_column_engraver :public Engraver {
Link_array<Rhythmic_head> rhead_l_arr_;
+ Link_array<Slur> grace_slur_endings_;
Stem * stem_l_;
Note_column *ncol_p_;
Dot_column *dotcol_l_;
class Rhythmic_head : public Item, public Staff_symbol_referencer
{
public:
-
-
+ Stem * stem_l_;
int balltype_i_;
int dots_i_;
Dots * dots_l_;
#ifndef SCORE_GRAV_HH
#define SCORE_GRAV_HH
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "global-translator.hh"
/**
--- /dev/null
+/*
+ g-script-column.hh -- declare Script_column
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef Script_COLUMN_HH
+#define Script_COLUMN_HH
+
+#include "item.hh"
+
+class Script_column : public Item
+{
+ /**
+ Array of objects that are placed by staffsides
+ */
+ Link_array<Item> staff_sided_item_l_arr_;
+public:
+ void add_staff_sided (Item*);
+protected:
+ virtual void do_pre_processing ();
+};
+
+
+#endif /* Script_COLUMN_HH */
+
+
--- /dev/null
+/*
+ script-engraver.hh -- part of GNU LilyPond
+
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef Script_GRAV
+#define Script_GRAV
+
+#include "engraver.hh"
+
+
+class Script_engraver : public Engraver {
+ Link_array<Script> script_p_arr_;
+ Link_array<Staff_side_item> staff_side_p_arr_;
+ Link_array<Articulation_req> script_req_l_arr_;
+
+public:
+ VIRTUAL_COPY_CONS(Translator);
+
+ Script_engraver();
+protected:
+ virtual bool do_try_music (Music*);
+ virtual void do_process_requests ();
+ virtual void do_pre_move_processing ();
+ virtual void do_post_move_processing ();
+ virtual void acknowledge_element (Score_element_info);
+};
+
+#endif // Script_GRAV
--- /dev/null
+/*
+ script.hh -- declare Script
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef SCRIPT_HH
+#define SCRIPT_HH
+
+#include "item.hh"
+#include "drul-array.hh"
+
+/**
+ Articulation marks (and the like) that are attached to notes/stems.
+ Needs support from Staff_side for proper operation. Staff_side
+ handles the positioning.
+
+*/
+class Script : public Item
+{
+ Staff_side_item * staff_side_l_;
+
+ Molecule get_molecule (Direction d) const;
+public:
+ Script ();
+ void set_staff_side (Staff_side_item*);
+
+protected:
+ virtual void do_print () const;
+ virtual void do_substitute_element_pointer (Score_element*o,
+ Score_element*n);
+ virtual void do_pre_processing ();
+ virtual void do_post_processing ();
+ Molecule* do_brew_molecule_p () const;
+};
+
+#endif /* Stem_SCRIPT_HH */
+
class Spring_spacer : public Line_spacer {
friend class Durations_iter;
private:
- Spring_spacer (Spring_spacer const&){}
+ // can't copy me.
+ Spring_spacer (Spring_spacer const&s);
Cons<Idealspacing> *ideal_p_list_;
Array<Column_info> cols_;
Array<Column_info> loose_col_arr_;
--- /dev/null
+/*
+ staff-side.hh -- declare Staff_side_{element,spanner,item}
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef STAFF_SIDE_HH
+#define STAFF_SIDE_HH
+
+
+#include "spanner.hh"
+#include "item.hh"
+#include "staff-symbol-referencer.hh"
+
+/**
+ Position myself next to a set of elements. Configurable in axis
+ and direction.
+
+ Properties:
+
+ padding :: Real
+
+ Amount of extra space to add.
+*/
+class Staff_side_element : public Staff_symbol_referencer
+{
+ void position_self ();
+
+public:
+ Score_element * to_position_l_;
+ Direction dir_;
+ Link_array<Score_element> support_l_arr_;
+ Axis axis_;
+ //junkme.
+ bool staff_support_b_;
+
+ Staff_side_element ();
+ void set_victim (Score_element*);
+ void add_support (Score_element*);
+
+ VIRTUAL_COPY_CONS(Score_element);
+ virtual Direction get_default_direction () const;
+protected:
+ virtual Interval do_height () const;
+ virtual void do_print () const;
+ virtual void do_add_processing ();
+ virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+ virtual void do_pre_processing ();
+ virtual void do_post_processing ();
+};
+
+class Staff_side_item : public Staff_side_element, public Item
+{
+public:
+ VIRTUAL_COPY_CONS(Score_element);
+protected:
+ virtual Interval do_width () const;
+ virtual void do_print () const;
+};
+
+class Staff_side_spanner : public Staff_side_element, public Spanner
+{
+public:
+ VIRTUAL_COPY_CONS(Score_element);
+protected:
+ virtual void do_print () const;
+};
+
+#endif /* STAFF_SIDE_HH */
+
--- /dev/null
+/*
+ stem-staff-side.hh -- declare Stem_staff_side
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef Stem_STAFF_SIDE_HH
+#define Stem_STAFF_SIDE_HH
+
+#include "staff-side.hh"
+/**
+ Position self, analogous to Staff_side_item, but use Stem direction
+ for determining direction.
+
+ Properties:
+
+ padding :: Real
+
+ Padding in staffline leading
+
+ */
+class Stem_staff_side_item : public Staff_side_item
+{
+ Stem *stem_l_;
+public:
+ Direction relative_dir_;
+
+ void set_stem (Stem*);
+ Stem_staff_side_item ();
+protected:
+ virtual Direction get_default_direction ()const;
+ virtual void do_pre_processing ();
+ virtual void do_substitute_element_pointer (Score_element*o,Score_element*e);
+};
+
+#endif /* Stem_STAFF_SIDE_HH */
+
--- /dev/null
+/*
+ text-item.hh -- declare Text_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef Text_ITEM_HH
+#define Text_ITEM_HH
+
+#include "item.hh"
+
+/**
+ Print a text in specified style.
+ */
+class Text_item : public Item
+{
+public:
+ String text_str_;
+ String style_str_;
+
+ Text_item ();
+ VIRTUAL_COPY_CONS (Score_element);
+protected:
+ virtual void do_print () const;
+ virtual Molecule *do_brew_molecule_p () const;
+};
+
+#endif /* Text_ITEM_HH */
+
int iterator_count_;
friend class Interpretation_context_handle;
+
Cons_list<Translator> trans_p_list_;
public:
virtual void do_post_move_processing();
virtual void do_creation_processing();
virtual void do_removal_processing();
- void each (Method_pointer);
- void each (Const_method_pointer) const;
+ virtual void each (Method_pointer);
+ virtual void each (Const_method_pointer) const;
};
#endif // TRANSLATOR_GROUP_HH
#include "tie.hh"
#include "note-head.hh"
#include "time-description.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
Local_key_engraver::Local_key_engraver()
c0_position_i_ = 0;
}
-void
-Local_key_item::add_support (Item*head_l)
-{
- if (support_items_.find_l(head_l))
- return ;
- support_items_.push (head_l);
- add_dependency (head_l);
-}
-
void
Local_key_item::add_pitch (Musical_pitch p, bool cautionary)
{
accidental_arr_.push (t);
}
+
void
Local_key_item::do_pre_processing()
{
accidental_arr_.sort (Local_key_cautionary_tuple::compare);
+ Note_head_side::do_pre_processing ();
}
Molecule*
output->add_at_edge (X_AXIS, RIGHT, m, 0);
}
- Interval x_int;
- for (int i=0; i < support_items_.size(); i++)
- {
- Dimension_cache *common =
- common_group (support_items_[i], X_AXIS);
-
- Real x = support_items_[i]->relative_coordinate (common, X_AXIS)
- - relative_coordinate (common, X_AXIS);
-
- x_int.unite (x + support_items_[i]->extent (X_AXIS));
- }
-
- if (x_int.empty_b ())
- x_int = Interval(0,0);
-
- output->translate_axis (-output->extent()[X_AXIS][RIGHT] + x_int[LEFT], X_AXIS);
-
return output;
}
-
-
void
-Local_key_item::do_substitute_element_pointer (Score_element*o,Score_element*n)
+Local_key_item::do_substitute_element_pointer (Score_element *o, Score_element*n)
{
- if (Item* o_l = dynamic_cast <Item *> (o))
- support_items_.substitute (o_l,dynamic_cast <Item *> (n));
+ Note_head_side::do_substitute_element_pointer (o,n);
+ Staff_symbol_referencer::do_substitute_element_pointer (o,n);
+
}
#include "lyric-engraver.hh"
#include "musical-request.hh"
-#include "g-text-item.hh"
+#include "text-item.hh"
#include "paper-def.hh"
#include "lookup.hh"
{
if (req_l_)
{
- text_p_= new G_text_item;
+ text_p_= new Text_item;
text_p_->text_str_ = req_l_->text_str_;
text_p_->text_str_ += " "; // ugh.
*/
#include "command-request.hh"
#include "mark-engraver.hh"
-#include "engraver-group.hh"
-#include "g-text-item.hh"
+#include "engraver-group-engraver.hh"
+#include "text-item.hh"
ADD_THIS_TRANSLATOR (Mark_engraver);
#include "new-repeated-music.hh"
#include "folded-repeat-iterator.hh"
#include "unfolded-repeat-iterator.hh"
+#include "grace-iterator.hh"
+#include "grace-music.hh"
void
Music_iterator::do_print() const
p = new Change_iterator;
else if (dynamic_cast<Time_scaled_music const *> (m))
p = new Time_scaled_music_iterator;
+ else if (dynamic_cast<Grace_music const*> (m))
+ p = new Grace_iterator;
else if (dynamic_cast<Music_wrapper const *> (m))
p = new Music_wrapper_iterator;
else if (New_repeated_music const * n = dynamic_cast<New_repeated_music const *> (m))
bool
Music_wrapper_iterator::ok () const
{
- return child_iter_p_->ok ();
+ return child_iter_p_ && child_iter_p_->ok ();
}
void
/*
- music-wrapper.cc -- implement
+ music-wrapper.cc -- implement Music_wrapper
source file of the GNU LilyPond music typesetter
{"duration", DURATION},
{"font", FONT},
{"grouping", GROUPING},
+ {"grace", GRACE},
{"header", HEADER},
{"in", IN_T},
{"lyrics", LYRICS},
--- /dev/null
+/*
+ note-head-side.cc -- implement Note_head_side
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#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);
+ add_dependency (head_l);
+}
+
+void
+Note_head_side::do_pre_processing ()
+{
+ Interval x_int;
+ for (int i=0; i < support_l_arr_.size(); i++)
+ {
+ Dimension_cache *common =
+ common_group (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)[RIGHT] + x_int[LEFT], X_AXIS);
+}
+
+void
+Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n)
+{
+ if (Item* o_l = dynamic_cast <Item *> (o))
+ support_l_arr_.substitute (o_l,dynamic_cast <Item *> (n));
+}
#include "lily-version.hh"
#include "atom.hh"
-// urg
-static SCM port = 0;
-
Paper_outputter::Paper_outputter (Paper_stream *s)
{
- port = 0;
outstream_l_ = s;
output_header ();
+ if (output_global_ch == String ("scm"))
+ *outstream_l_->os << ""
+ "(primitive-load-path 'lily.scm)\n"
+ "(eval (tex-scm 'all-definitions))\n"
+ ";(eval (ps-scm 'all-definitions))\n"
+ "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n"
+ ;
}
Paper_outputter::~Paper_outputter ()
if (String (output_global_ch) == "scm")
{
-#if 1
- scm_display (gh_str02scm (")))\n"), port);
- scm_fflush (port);
-#else
*outstream_l_->os << ")";
-#endif
}
}
{
if (String (output_global_ch) == "scm")
{
-#if 1
- /*
- we'd rather use C++ i/o iso Guile's, but how?
- and: they can't be mixed (or synchronised) easily?
- */
-
- // urg
- if (!port)
- {
- int fd = 1;
- ofstream * of = dynamic_cast<ofstream*> (outstream_l_->os);
- if (of)
- fd = of->rdbuf()->fd();
- FILE *file = fdopen (fd, "a");
- port = scm_standard_stream_to_port (file, "a", "");
- scm_display (gh_str02scm (
- "(primitive-load-path 'lily.scm)\n"
- "(eval (tex-scm 'all-definitions))\n"
- ";(eval (ps-scm 'all-definitions))\n"
- "(display (map (lambda (x) (string-append (eval x) \"%\\n\")) '(\n"
- ), port);
- }
-
- scm_write (scm, port);
- // duh
- scm_display (gh_str02scm ("\n"), port);
- scm_fflush (port);
-#else
- static bool first = true;
- if (first)
- {
- *outstream_l_->os << ""
- "(primitive-load-path 'lily.scm)\n"
- "(eval (tex-scm 'all-definitions))\n"
- ";(eval (ps-scm 'all-definitions))\n"
- "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n"
- ;
- }
-
- /*
- why doesn't this work?
-
- ERROR: In procedure gh_scm2newstr:
- ERROR: Wrong type argument in position 3:
- (header "GNU LilyPond 1.1.49.jcn1" ", at Tue Jun 22 20:58:17 1999")
-
- or:
-
- ERROR: In procedure symbol->string:
- ERROR: Wrong type argument in position 1:
- (header "GNU LilyPond 1.1.49.jcn2" ", at Wed Jun 23 18:42:14 1999")
-
- eg, two ways to print '(foo bar)'
-
- SCM scm = gh_list (ly_symbol ("foo"), gh_str2scm ("bar"), SCM_UNDEFINED);
- scm_write (scm, port);
- puts (gh_xxx2newstr (scm, 0));
- */
-
- char* p;
- //p = gh_scm2newstr (scm, 0);
- //p = gh_symbol2newstr (scm, 0);
- //p = gh_scm2newstr (scm_symbol_to_string (scm), 0);
- //p = gh_symbol2newstr (scm_symbol_to_string (scm), 0);
- //*outstream_l_->os << p << endl;
- *outstream_l_->os << symbol_to_string (scm) << endl;
-#endif
+ SCM result = scm_eval (scm_listify (ly_symbol ("scm->string"), ly_quote_scm (scm), SCM_UNDEFINED));
+ *outstream_l_->os << ly_scm2string (result) << endl;
}
else
{
#include "time-scaled-music.hh"
#include "new-repeated-music.hh"
#include "version.hh"
-
+#include "grace-music.hh"
// mmm
Mudela_version oldest_version ("1.0.20");
%token EXTENDER
%token FONT
%token GROUPING
+%token GRACE
%token HEADER
%token IN_T
%token KEY
$$ = csm;
}
+ | GRACE Music {
+ $$ = new Grace_music ($2);
+ }
| CONTEXT STRING '=' STRING Music {
Context_specced_music *csm = new Context_specced_music ($5);
request_with_dir:
script_dir request_that_take_dir {
- if (G_script_req * gs = dynamic_cast<G_script_req*> ($2))
+ if (Script_req * gs = dynamic_cast<Script_req*> ($2))
gs->dir_ = Direction ($1);
else if ($1)
$2->warning ("Can't specify direction for this request");
#include "multi-measure-rest.hh"
#include "command-request.hh"
#include "time-description.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "new-repeated-music.hh"
#include "time-description.hh"
#include "volta-spanner.hh"
Folded_repeat_iterator::enter_alternative ()
{
New_repeated_music const * mus = dynamic_cast<New_repeated_music const*> (music_l_);
- Simultaneous_music_iterator * s = new Simultaneous_music_iterator;
- s->separate_contexts_b_ = true;
- s->init_translator (mus->alternatives_p_, report_to_l ());
+ if (mus->alternatives_p_)
+ {
+ Simultaneous_music_iterator * s = new Simultaneous_music_iterator;
+ s->separate_contexts_b_ = true;
+ s->init_translator (mus->alternatives_p_, report_to_l ());
- alternative_iter_p_ = s;
- alternative_iter_p_->construct_children ();
+ alternative_iter_p_ = s;
+ alternative_iter_p_->construct_children ();
+ }
}
void
(c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "slur.hh"
#include "rhythmic-column-engraver.hh"
#include "note-head.hh"
#include "stem.hh"
for (int i=0; i < rhead_l_arr_.size (); i++)
{
- ncol_p_->add_head (rhead_l_arr_[i]);
+ if (!rhead_l_arr_[i]->dim_cache_[X_AXIS]->parent_l_)
+ ncol_p_->add_head (rhead_l_arr_[i]);
}
rhead_l_arr_.set_size (0);
}
if (ncol_p_)
{
- if (dotcol_l_)
+ if (dotcol_l_
+ && !dotcol_l_->dim_cache_[X_AXIS]->parent_l_)
{
ncol_p_->set_dotcol (dotcol_l_);
}
- if (stem_l_)
+ if (stem_l_
+ && !stem_l_->dim_cache_[X_AXIS]->parent_l_)
{
ncol_p_->set_stem (stem_l_);
stem_l_ = 0;
}
+
+ /*
+ since ncol_p_ is announced, it already has its grace_scm_sym set, if we're
+ in a Grace context.
+ */
+ if (ncol_p_->get_elt_property (grace_scm_sym) == SCM_BOOL_F)
+ for (int i=0; i < grace_slur_endings_.size(); i++)
+ grace_slur_endings_[i]->add_column (ncol_p_);
+ grace_slur_endings_.clear ();
}
}
Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
{
Item * item = dynamic_cast <Item *> (i.elem_l_);
- if (!item)
- return;
- if (Stem*s=dynamic_cast<Stem *> (item))
+ if (Stem*s=dynamic_cast<Stem *> (item))
{
stem_l_ = s;
}
- else if (Rhythmic_head*r=dynamic_cast<Rhythmic_head *> (item))
+ else if (Rhythmic_head*r=dynamic_cast<Rhythmic_head *> (item))
{
rhead_l_arr_.push (r);
}
- else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
+ else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
{
dotcol_l_ = d;
}
+ else if (Slur *s = dynamic_cast<Slur*> (i.elem_l_))
+ {
+ /*
+ end slurs starting on grace notes
+ */
+
+ if (s->get_elt_property (grace_scm_sym) != SCM_BOOL_F)
+ grace_slur_endings_.push (s);
+ }
}
void
void
Rhythmic_column_engraver::do_post_move_processing()
{
+ grace_slur_endings_.clear ();
dotcol_l_ =0;
stem_l_ =0;
}
#include "dots.hh"
#include "axis-group-element.hh"
#include "p-score.hh"
+#include "stem.hh"
void
Rhythmic_head::do_add_processing ()
if (dots_i_ && !dots_l_)
{
assert (false);
- /* Dots *d = new Dots;
- add_dots (d);
- pscore_l_->typeset_element (d);
-
-
-
- axis_group_l_a_[Y_AXIS]->add_element (d);
- axis_group_l_a_[X_AXIS]->add_element (d);*/
}
if (dots_l_)
{
dots_l_ =0;
balltype_i_ =0;
dots_i_ = 0;
+ stem_l_ =0;
}
void
Rhythmic_head::do_substitute_element_pointer (Score_element*o,Score_element*n)
{
if (o == dots_l_)
- dots_l_ = n ? dynamic_cast<Dots *> (n) :0;
+ dots_l_ = dynamic_cast<Dots *> (n) ;
+ else if (o == stem_l_)
+ stem_l_ = dynamic_cast<Stem*>(n);
}
removal_processing();
}
+/*
+ use start/finish?
+ */
void
-Score_engraver::do_creation_processing()
+Score_engraver::do_creation_processing ()
{
scoreline_l_ = pscore_p_->line_l_;
scoreline_l_->set_bounds(LEFT,command_column_l_);
command_column_l_->set_elt_property (breakable_scm_sym, SCM_BOOL_T);
+
Engraver_group_engraver::do_creation_processing();
}
+
void
Score_engraver::do_removal_processing()
{
Engraver_group_engraver::do_announces, then
announce_info_arr_.size() will be nonzero again
*/
+/* junkme? Done by Engraver_group_engraver::do_announces ()?
+ */
+
void
Score_engraver::do_announces()
{
return ;
}
- trans_p->start();
-
- while (iter->ok() || trans_p->moments_left_i ())
- {
- Moment w;
- w.set_infinite (1);
- if (iter->ok())
- {
- w = iter->next_moment();
- DOUT << "proccing: " << w << '\n';
- if (!monitor->silent_b ("walking"))
- iter->print();
- }
-
- trans_p->modify_next (w);
- trans_p->prepare (w);
-
- if (!monitor->silent_b ("walking"))
- trans_p->print();
-
- iter->process_and_next (w);
- trans_p->process();
- }
-
+ trans_p->start ();
+ trans_p->run_iterator_on_me (iter);
delete iter;
- trans_p->finish();
-
+ trans_p->finish ();
if (errorlevel_i_)
{
--- /dev/null
+/*
+ g-script-column-engraver.cc -- implement Script_column_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "engraver.hh"
+#include "script-column.hh"
+#include "staff-side.hh"
+
+/**
+ Find potentially colliding scripts, and put them in a
+ Script_column, that will fix the collisions. */
+class Script_column_engraver : public Engraver
+{
+ Script_column *scol_p_;
+ Link_array<Item> script_l_arr_;
+ Link_array<Staff_side_item> staff_side_l_arr_;
+public:
+ Script_column_engraver ();
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+ virtual void acknowledge_element (Score_element_info);
+ virtual void process_acknowledged ();
+ virtual void do_pre_move_processing ();
+ virtual void do_post_move_processing ();
+};
+
+
+Script_column_engraver::Script_column_engraver()
+{
+ scol_p_ =0;
+}
+
+void
+Script_column_engraver::do_pre_move_processing ()
+{
+ if (scol_p_)
+ {
+ typeset_element (scol_p_);
+ scol_p_ =0;
+ }
+}
+
+void
+Script_column_engraver::do_post_move_processing ()
+{
+ script_l_arr_.clear ();
+ staff_side_l_arr_.clear ();
+}
+
+void
+Script_column_engraver::acknowledge_element( Score_element_info inf)
+{
+ Item *thing = dynamic_cast<Item*>(inf.elem_l_);
+ if (!thing)
+ return;
+
+ Dimension_cache * parcache = thing->dim_cache_[Y_AXIS]->parent_l_;
+ if (!parcache || !thing)
+ return ;
+
+ Graphical_element *parent = parcache->element_l ();
+
+ if (Staff_side_item * ss = dynamic_cast<Staff_side_item*>(parent))
+ {
+ if (!ss->breakable_b ())
+ {
+ script_l_arr_.push (thing);
+ }
+ }
+}
+
+void
+Script_column_engraver::process_acknowledged ()
+{
+ if (!scol_p_ && script_l_arr_.size () > 1)
+ {
+ scol_p_ = new Script_column;
+ announce_element (Score_element_info (scol_p_, 0));
+ }
+
+ if (scol_p_)
+ {
+ for (int i=0; i < script_l_arr_.size (); i++)
+ scol_p_->add_staff_sided (script_l_arr_[i]);
+ script_l_arr_.clear ();
+ }
+}
+ADD_THIS_TRANSLATOR(Script_column_engraver);
--- /dev/null
+/*
+ g-script-column.cc -- implement Script_column
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "script-column.hh"
+#include "staff-side.hh"
+
+static Staff_side_item *
+get_Staff_side (Item *i)
+{
+ Graphical_element *e1 = i->dim_cache_[Y_AXIS]->parent_l_->element_l ();
+
+ return dynamic_cast<Staff_side_item*>(e1);
+}
+
+void
+Script_column::add_staff_sided (Item *i)
+{
+ SCM p = get_Staff_side (i)->get_elt_property (script_priority_scm_sym);
+ if (p == SCM_BOOL_F)
+ return;
+
+ staff_sided_item_l_arr_.push (i);
+ add_dependency (i);
+}
+
+static int
+staff_side_compare (Item * const &i1,
+ Item * const &i2)
+{
+ Score_element *e1 = get_Staff_side (i1);
+ Score_element *e2 = get_Staff_side (i2);
+
+ SCM p1 = e1->get_elt_property (script_priority_scm_sym);
+ SCM p2 = e2->get_elt_property (script_priority_scm_sym);
+
+ return gh_scm2int (SCM_CDR(p1)) - gh_scm2int (SCM_CDR(p2));
+}
+
+void
+Script_column::do_pre_processing ()
+{
+ Drul_array<Link_array<Item> > arrs;
+
+ for (int i=0; i < staff_sided_item_l_arr_.size (); i++)
+ {
+ Staff_side_item * ip = get_Staff_side (staff_sided_item_l_arr_[i]);
+ arrs[ip->dir_].push (staff_sided_item_l_arr_[i]);
+ }
+
+ Direction d = DOWN;
+ do {
+ Link_array<Item> &arr(arrs[d]);
+
+ arr.sort (staff_side_compare);
+
+ Item * last = 0;
+ for (int i=0; i < arr.size (); i++)
+ {
+ Staff_side_item * gs = get_Staff_side (arr[i]);
+ if (last)
+ {
+ gs->add_support (last);
+ gs->add_support (get_Staff_side (last));
+ }
+
+ gs->remove_elt_property (script_priority_scm_sym);
+ last = arr[i];
+ }
+
+ } while (flip (&d) != DOWN);
+}
--- /dev/null
+/*
+ script-engraver.cc -- implement Script_engraver
+
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "script-engraver.hh"
+#include "script.hh"
+#include "stem-staff-side.hh"
+#include "musical-request.hh"
+#include "stem.hh"
+#include "staff-symbol.hh"
+#include "rhythmic-head.hh"
+
+Script_engraver::Script_engraver()
+{
+ do_post_move_processing();
+}
+
+bool
+Script_engraver::do_try_music (Music *r_l)
+{
+ if (Articulation_req *mr = dynamic_cast <Articulation_req *> (r_l))
+ {
+ for (int i=0; i < script_req_l_arr_.size(); i++)
+ {
+ if (script_req_l_arr_[i]->equal_b (mr))
+ return true;
+ }
+ script_req_l_arr_.push (mr);
+ return true;
+ }
+ return false;
+}
+
+void
+Script_engraver::do_process_requests()
+{
+ for (int i=0; i < script_req_l_arr_.size(); i++)
+ {
+ Articulation_req* l=script_req_l_arr_[i];
+
+
+ SCM list = gh_eval_str (("(articulation-to-scriptdef \"" + l->articulation_str_ + "\")").ch_C());
+
+ if (list == SCM_BOOL_F)
+ {
+ l->warning(_f("don't know how to interpret articulation `%s'\n",
+ l->articulation_str_.ch_C()));
+ continue;
+ }
+ Script *p =new Script;
+ Stem_staff_side_item * ss =new Stem_staff_side_item;
+ list = SCM_CDR (list);
+
+ p->set_elt_property (molecule_scm_sym,
+ SCM_CAR(list));
+
+ list = SCM_CDR(list);
+ bool follow_staff = gh_scm2bool (SCM_CAR(list));
+ list = SCM_CDR(list);
+ int relative_stem_dir = gh_scm2int (SCM_CAR(list));
+ list = SCM_CDR(list);
+ int force_dir =gh_scm2int (SCM_CAR(list));
+ list = SCM_CDR(list);
+ SCM priority = SCM_CAR(list);
+
+ if (relative_stem_dir)
+ ss->relative_dir_ = relative_stem_dir;
+ else
+ ss->dir_ = force_dir;
+
+ if (l->dir_)
+ ss->dir_ = l->dir_;
+
+ Real padding = 1.0;
+ Scalar paddingprop = get_property ("articulationScriptPadding", 0);
+ if (paddingprop.length_i() && paddingprop.isnum_b ())
+ {
+ padding = (Real)paddingprop;
+ }
+
+ ss->staff_support_b_ = !follow_staff;
+ p->set_staff_side (ss);
+ ss->set_elt_property (script_priority_scm_sym, priority);
+ ss->set_elt_property (padding_scm_sym, gh_double2scm(padding));
+ script_p_arr_.push (p);
+ staff_side_p_arr_.push (ss);
+
+ announce_element (Score_element_info (p, l));
+ announce_element (Score_element_info (ss, l));
+ }
+}
+
+void
+Script_engraver::acknowledge_element (Score_element_info inf)
+{
+ if (Stem *s = dynamic_cast<Stem*>(inf.elem_l_))
+ {
+ for (int i=0; i < staff_side_p_arr_.size(); i++)
+ if (Stem_staff_side_item * ss = dynamic_cast<Stem_staff_side_item*>(staff_side_p_arr_[i]))
+ {
+ ss->set_stem (s);
+ ss->add_support (s);
+ }
+ }
+ else if (Rhythmic_head * rh = dynamic_cast<Rhythmic_head*>(inf.elem_l_))
+ {
+ for (int i=0; i < staff_side_p_arr_.size(); i++)
+ {
+ Staff_side_item * ss = dynamic_cast<Staff_side_item*>(staff_side_p_arr_[i]);
+
+ if (!ss->dim_cache_[X_AXIS]->parent_l_)
+ {
+ ss->dim_cache_[X_AXIS]->parent_l_ = inf.elem_l_->dim_cache_[X_AXIS];
+ }
+ ss->add_support (rh);
+ }
+ }
+}
+
+void
+Script_engraver::do_pre_move_processing()
+{
+ for (int i=0; i < script_p_arr_.size(); i++)
+ {
+ typeset_element (script_p_arr_[i]);
+ typeset_element (staff_side_p_arr_[i]);
+ }
+ script_p_arr_.clear();
+ staff_side_p_arr_.clear ();
+}
+
+void
+Script_engraver::do_post_move_processing()
+{
+ script_req_l_arr_.clear();
+}
+
+
+
+ADD_THIS_TRANSLATOR(Script_engraver);
+
--- /dev/null
+/*
+ g-script.cc -- implement Script
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+/*
+
+ TODO: Quantisation support (staccato dots between stafflines)
+
+*/
+#include "debug.hh"
+#include "script.hh"
+#include "lookup.hh"
+#include "staff-side.hh"
+#include "paper-def.hh"
+
+Script::Script ()
+{
+ staff_side_l_ =0;
+}
+
+void
+Script::do_substitute_element_pointer (Score_element*o, Score_element*n)
+{
+ if (o == staff_side_l_)
+ staff_side_l_ = dynamic_cast<Staff_side_item*>(n);
+}
+
+
+
+Molecule
+Script::get_molecule(Direction d) const
+{
+ SCM s = get_elt_property (molecule_scm_sym);
+ assert (s != SCM_BOOL_F);
+
+ s = SCM_CDR(s);
+ SCM key = SCM_CAR (s);
+ if (key == ly_symbol ("feta"))
+ {
+ return lookup_l ()->afm_find ("scripts-" +
+ ly_scm2string (index_cell (SCM_CDR (s), d)));
+ }
+ else if (key == ly_symbol ("accordion"))
+ {
+ return lookup_l ()->accordion (SCM_CDR(s), paper_l()->get_realvar(interline_scm_sym));
+ }
+
+ else assert (false);
+
+ return Molecule ();
+}
+
+
+void
+Script::do_pre_processing ()
+{
+ Graphical_element * e
+ = staff_side_l_->dim_cache_[X_AXIS]->parent_l_->element_l();
+ translate_axis (e->extent (X_AXIS).center (), X_AXIS);
+}
+
+void
+Script::do_post_processing ()
+{
+ Direction d = staff_side_l_->dir_;
+ Molecule m (get_molecule(d));
+ translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
+}
+
+void
+Script::set_staff_side (Staff_side_item*g)
+{
+ staff_side_l_ = g;
+ add_dependency (g);
+ dim_cache_[Y_AXIS]->parent_l_ = g->dim_cache_[Y_AXIS];
+}
+
+Molecule*
+Script::do_brew_molecule_p () const
+{
+ return new Molecule (get_molecule (staff_side_l_->dir_));
+}
+
+void
+Script::do_print () const
+{
+
+}
(c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
+#include "grace-iterator.hh"
#include "translator-group.hh"
#include "debug.hh"
#include "sequential-music-iterator.hh"
void
Sequential_music_iterator::set_sequential_music_translator()
{
- if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
+ if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ()
+ && ! dynamic_cast<Grace_iterator*> (iter_p_)) // UGH.!
set_translator (iter_p_->report_to_l());
}
int j = 0;
Music_sequence const *sim = dynamic_cast<Music_sequence const*> (music_l_);
- for (Cons<Music> *i = sim->music_p_list_p_->head_; i; i = i->next_, j++)
+ Cons<Music> *i = (sim->music_p_list_p_) ? sim->music_p_list_p_->head_ : 0;
+ for (; i; i = i->next_, j++)
{
Music_iterator * mi = static_get_iterator_p (i->car_);
#include "staff-margin-engraver.hh"
#include "bar.hh"
#include "time-description.hh"
-#include "g-text-item.hh"
-#include "g-staff-side.hh"
+#include "text-item.hh"
+#include "staff-side.hh"
ADD_THIS_TRANSLATOR (Staff_margin_engraver);
--- /dev/null
+/*
+ g-staff-side.cc -- implement Staff_side_element
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "staff-side.hh"
+#include "staff-symbol.hh"
+#include "debug.hh"
+#include "warn.hh"
+#include "dimensions.hh"
+
+Staff_side_element::Staff_side_element ()
+{
+ dir_ = CENTER;
+ to_position_l_ = 0;
+ set_elt_property (transparent_scm_sym, SCM_BOOL_T);
+ staff_support_b_ = true;
+ axis_ = Y_AXIS;
+}
+
+
+
+void
+Staff_side_element::do_pre_processing ()
+{
+ if (!dir_)
+ dir_ = get_default_direction ();
+
+ if (axis_ == X_AXIS)
+ position_self ();
+}
+
+Direction
+Staff_side_element::get_default_direction () const
+{
+ return DOWN;
+}
+
+
+void
+Staff_side_element::set_victim (Score_element *e)
+{
+ add_dependency (e);
+ to_position_l_ = e;
+ to_position_l_->dim_cache_[axis_]->parent_l_ = dim_cache_[axis_];
+}
+
+void
+Staff_side_element::add_support (Score_element*e)
+{
+ add_dependency (e);
+ support_l_arr_.push (e);
+}
+
+
+void
+Staff_side_element::do_substitute_element_pointer (Score_element*o, Score_element*n)
+{
+ Staff_symbol_referencer::do_substitute_element_pointer (o,n);
+ if (o == to_position_l_)
+ to_position_l_ = n;
+ else
+ support_l_arr_.unordered_substitute (o,n);
+}
+
+void
+Staff_side_element::position_self ()
+{
+ if (to_position_l_ &&
+ to_position_l_->get_elt_property (transparent_scm_sym) != SCM_BOOL_F)
+ return;
+
+ Interval dim;
+ Dimension_cache *common = 0;
+ if (support_l_arr_.size ())
+ {
+ common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
+ axis_);
+
+ for (int i=0; i < support_l_arr_.size (); i++)
+ {
+ Score_element * e = support_l_arr_ [i];
+ Real coord = e->relative_coordinate (common, axis_);
+
+ dim.unite (coord + e->extent (axis_));
+ }
+ }
+ else
+ common = dim_cache_[axis_]->parent_l_;
+
+ if (dim.empty_b ())
+ {
+ dim = Interval(0,0);
+ }
+
+
+ Interval sym_dim
+ = to_position_l_
+ ? to_position_l_->extent (axis_)
+ : Interval(0,0);
+
+ Real off = dim_cache_[axis_]->relative_coordinate (common);
+
+ SCM pad = remove_elt_property (padding_scm_sym);
+ if (pad != SCM_BOOL_F)
+ {
+ off += gh_scm2double (SCM_CDR(pad)) * dir_;
+ }
+ Real total_off = dim[dir_] - sym_dim[-dir_] + off;
+ dim_cache_[axis_]->set_offset (total_off);
+ if (fabs (total_off) > 100 CM)
+ programming_error ("Huh ? Improbable staff side dim.");
+}
+
+void
+Staff_side_element::do_post_processing ()
+{
+ if (axis_ == Y_AXIS)
+ position_self ();
+}
+
+
+void
+Staff_side_element::do_add_processing ()
+{
+ if (staff_support_b_
+ && axis_ == Y_AXIS && staff_symbol_l ())
+ {
+ add_support (staff_symbol_l ());
+ }
+}
+
+Interval
+Staff_side_element::do_height () const
+{
+ Interval i;
+ if (to_position_l_)
+ return to_position_l_->extent (Y_AXIS);
+ return i;
+}
+
+void
+Staff_side_element::do_print () const
+{
+#ifndef NPRINT
+ if (to_position_l_)
+ DOUT << "positioning " << to_position_l_->name();
+
+ DOUT << "axis == " << axis_name_str (axis_)
+ << ", dir == " << to_str (dir_ );
+#endif
+}
+
+
+Interval
+Staff_side_item::do_width () const
+{
+ Interval i;
+ if (to_position_l_)
+ return to_position_l_->extent (X_AXIS);
+ return i;
+}
+
+void
+Staff_side_item::do_print () const
+{
+ Staff_side_element::do_print ();
+}
+
+void
+Staff_side_spanner::do_print () const
+{
+ Staff_side_element::do_print ();
+}
#include "engraver.hh"
#include "interpretation-context-handle.hh"
#include "drul-array.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
#include "musical-request.hh"
class Staff_switching_translator : public Engraver
{
if (Rhythmic_head * h = dynamic_cast<Rhythmic_head *> (i.elem_l_))
{
+ if (h->stem_l_)
+ return;
+
Rhythmic_req * r = dynamic_cast <Rhythmic_req *> (i.req_l_);
int duration_log = r->duration_.durlog_i_;
if (!stem_p_)
((Translator_group*)which)->set_property ("stemRightBeamCount", "");
}
+ prop = get_property ("stemLength", 0);
+ if (prop.isnum_b ())
+ {
+ stem_p_->set_elt_property (length_scm_sym, gh_double2scm (prop.to_f ()));
+ }
+
typeset_element(stem_p_);
stem_p_ = 0;
}
Real min_stem_f = paper_l->get_var (String ("minimum_stem_length")
+ to_str (mult_i_ <? stem_max));
Real stem_f = paper_l->get_var (String ("stem_length")
- + to_str (mult_i_ <? stem_max));
+ + to_str (mult_i_ <? stem_max))* internote_f;
if (!beam_dir_ || (beam_dir_ == dir_))
/* normal beamed stem */
--- /dev/null
+/*
+ g-stem-staff-side.cc -- implement Stem_staff_side
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "stem-staff-side.hh"
+#include "stem.hh"
+
+Stem_staff_side_item::Stem_staff_side_item ()
+{
+ stem_l_ =0;
+ relative_dir_ = CENTER;
+}
+
+void
+Stem_staff_side_item::do_substitute_element_pointer (Score_element*o,
+ Score_element*n)
+{
+ if (o == stem_l_)
+ {
+ stem_l_ = dynamic_cast<Stem*> (n);
+ }
+}
+
+void
+Stem_staff_side_item::set_stem (Stem*s)
+{
+ stem_l_ =s;
+ add_dependency (s);
+}
+
+
+Direction
+Stem_staff_side_item::get_default_direction () const
+{
+ return relative_dir_ * stem_l_->dir_;
+}
+
+void
+Stem_staff_side_item::do_pre_processing ()
+{
+ SCM p = remove_elt_property (padding_scm_sym);
+ if (p != SCM_BOOL_F && stem_l_)
+ {
+ p = SCM_CDR (p);
+ set_elt_property (padding_scm_sym,
+ gh_double2scm(stem_l_->staff_line_leading_f ()
+ * gh_scm2double (p)));
+ }
+ Staff_side_item::do_pre_processing ();
+}
void
Stem::add_head (Rhythmic_head *n)
{
+ n->stem_l_ = this;
n->add_dependency (this); // ?
if (Note_head *nh = dynamic_cast<Note_head *> (n))
{
void
Stem::set_default_stemlen ()
{
- Real internote_f = staff_line_leading_f ()/2.0;
- Real length_f = paper_l ()->get_var ("stem_length0") / internote_f;
- Real shorten_f = paper_l ()->get_var ("forced_stem_shorten0") / internote_f;
+ Real length_f = 0.;
+ SCM scm_len = get_elt_property(length_scm_sym);
+ if (scm_len != SCM_BOOL_F)
+ {
+ length_f = gh_scm2double (SCM_CDR(scm_len));
+ }
+ else
+ length_f = paper_l ()->get_var ("stem_length0");
+
+ Real shorten_f = paper_l ()->get_var ("forced_stem_shorten0");
if (!dir_)
dir_ = get_default_dir ();
if (!invisible_b ())
{
Real stem_width = paper_l ()->get_var ("stemthickness");
- Molecule ss =lookup_l ()->filledbox (Box (Interval (-stem_width/2, stem_width/2),
+ Molecule ss =lookup_l ()->filledbox (Box (Interval (-stem_width/2, stem_width/2),
Interval (stem_y[DOWN]*dy, stem_y[UP]*dy)));
mol_p->add_molecule (ss);
}
*/
#include "engraver.hh"
-#include "g-staff-side.hh"
-#include "g-text-item.hh"
+#include "staff-side.hh"
+#include "text-item.hh"
#include "musical-request.hh"
#include "note-head.hh"
#include "stem.hh"
class Text_engraver : public Engraver
{
Link_array<Text_script_req> reqs_;
- Link_array<G_staff_side_item> positionings_;
- Link_array<G_text_item> texts_;
+ Link_array<Staff_side_item> positionings_;
+ Link_array<Text_item> texts_;
public:
Text_engraver();
VIRTUAL_COPY_CONS(Translator);
{
Text_script_req * r = reqs_[i];
- G_text_item *text = new G_text_item;
- G_staff_side_item *ss = new G_staff_side_item;
+ Text_item *text = new Text_item;
+ Staff_side_item *ss = new Staff_side_item;
ss->set_victim (text);
ss->set_elt_property (script_priority_scm_sym,
--- /dev/null
+/*
+ text-item.cc -- implement Text_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "text-item.hh"
+#include "debug.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+
+Molecule*
+Text_item::do_brew_molecule_p () const
+{
+ Molecule a= paper_l ()->lookup_l(0)->text (style_str_,text_str_, paper_l ());
+
+ return new Molecule (a);
+}
+
+Text_item::Text_item ()
+{
+ style_str_ = "roman";
+}
+
+void
+Text_item::do_print () const
+{
+ DOUT << "text= " << text_str_;
+}
#include "time-signature.hh"
#include "command-request.hh"
#include "timing-engraver.hh"
-#include "engraver-group.hh"
+#include "engraver-group-engraver.hh"
Time_signature_engraver::Time_signature_engraver()
{
}
}
-
-
-
-
void
Translator_group::add_translator (Translator *trans_p)
{
\consists "Bar_engraver";
\consists "Clef_engraver";
\consists "Key_engraver";
- \consists "Local_key_engraver";
\consists "Time_signature_engraver";
\consists "Staff_symbol_engraver";
\consists "Collision_engraver";
\consists "Dynamic_engraver"; % must come before text_engraver.
\name Voice ;
beamAuto = "1";
+ \consists "Local_key_engraver";
\consists "Breathing_sign_engraver";
\consists "Rest_engraver";
% ugh. Order matters here.
\consists "Text_engraver";
- \consists "G_script_engraver";
- \consists "G_script_column_engraver";
+ \consists "Script_engraver";
+ \consists "Script_column_engraver";
\consists "Rhythmic_column_engraver";
\consists "Font_size_engraver";
\consists "Slur_engraver";
\consists "Tie_engraver";
- \consists "Tuplet_engraver";
+ \consists "Tuplet_engraver";
+ \consists "Grace_position_engraver";
\consists "Skip_req_swallow_translator";
\accepts Thread; % bug if you leave out this!
+ \accepts Grace;
};
+GraceContext=\translator {
+ \type "Grace_engraver_group";
+ \name "Grace";
+ \consists "Note_heads_engraver";
+ \consists "Stem_engraver";
+ \consists "Slur_engraver";
+ \consists "Timing_engraver"; %UGH.
+ \consists "Beam_engraver";
+ \consists "Align_note_column_engraver";
+ \consists "Font_size_engraver";
+ \consists "Rhythmic_column_engraver";
+
+ fontSize = "-1";
+ stemLength = "6.0";
+ verticalDirection = "1";
+};
+\translator{\GraceContext}
\translator {\VoiceContext}
ThreadContext = \translator{
%
% poor man's array size
stem_max = 3.0;
-%
-stem_length0 = 3.5*\interline;
-stem_length1 = 2.5 * \interline;
-stem_length2 = 2.0 * \interline;
-stem_length3 = 1.5 * \interline;
+
+% stem stuff measured in staff positions.
+stem_length0 = 7.;
+stem_length1 = 5.;
+stem_length2 = 4.;
+stem_length3 = 3.;
% only used for beams
-minimum_stem_length0 = 0.0; % not used
-minimum_stem_length1 = 1.5 * \interline;
-minimum_stem_length2 = 1.25 * \interline;
-minimum_stem_length3 = 1.0 * \interline;
+minimum_stem_length0 = 0.0 ; % not used
+minimum_stem_length1 = 3. ;
+minimum_stem_length2 = 2.5;
+minimum_stem_length3 = 2.0;
% stems in unnatural (forced) direction should be shortened,
% according to [Roush & Gourlay]. Their suggestion to knock off
% a whole staffspace seems a bit drastical: we'll do half.
%
-forced_stem_shorten0 = 0.5 * \interline;
+forced_stem_shorten0 = 1.0;
forced_stem_shorten1 = \forced_stem_shorten0;
forced_stem_shorten2 = \forced_stem_shorten1;
forced_stem_shorten3 = \forced_stem_shorten2;
(let* ((keywords '("alternative" "repeat"
"accepts" "accidentals" "break" "bar" "cadenza"
"clef" "cm" "consists" "consistsend" "contains" "duration"
- "spanrequest" "scmfile" "lyrics"
+ "spanrequest" "grace" "scmfile" "lyrics"
"in" "translator" "context" "key" "maininput" "notes"
"musical_pitch" "time" "midi" "mm" "header"
"notenames" "octave" "output" "partial" "paper" "plet" "name"
}
-\version "1.0.16";
+\version "1.0.20";
\include "paper16.ly";
\include "paper13.ly";
pianoRH=\notes \relative c'' {
\clef "G";
%1
- <[b,8-.(\pp d-. g-.> <b8-. d-. g-.> <b-. d-. g-.> <)b-. d-. g-.>]
- <[b8-. d-. g-.(> <b8-. d-. g-.> <b-. d-. g-.> <)b-. d-. g-.>]
+ <[b,8-.(\pp d-. g-.> <b-. d-. g-.> <b-. d-. g-.> <)b-. d-. g-.>]
+ <[b8-. d-. g-.(> <b-. d-. g-.> <b-. d-. g-.> <)b-. d-. g-.>]
|
%2
<[c d g_"{\it simile}" \< > <c d g> <c d fis> <c d fis>]
<[d a' b> <d a' b> <d g! b> <d g b>]
<[d g a> <d g a> <d fis a> <d fis a>] |
%5
- \repeat 2 {
+ \repeat semi 2 {
<[b_. d g( \pp > <b_. d g> <b_. d g> <)b_. d g>]
<[b_. d g(> <b_. d g> <b_. d g> <)b_. d g>]
|
)b4-. [d,8.( d16] )c'4-. [d,8. d16] |
%4
d'4-. d,-. d'-. [d,8.( d16 ]
- \repeat 2 {
+ \repeat semi 2 {
%5
)g4-. d_. r4 [g8.( g16] |
%6
\property Voice.dynamicdir = "1"
r1 | r1 |r1 | r1 |
- \repeat 2 {
+ \repeat semi 2 {
%5
b2. g4 |
%6
>
>
\paper {
- % \paper_thirteen;
- \paper_sixteen;
+ % \paper_thirteen
+ \paper_sixteen
linewidth = 18.0\cm;
textheight = 26.0\cm;
gourlay_maxmeasures=15.0;
%{
Tested Features: cadenza mode
-
-Ugh.. Wish we had grace notes.... It adds another dimension to this
-piece of music. %}
+%}
\version "1.0.21";
[e'^"accel" () d c b]
[b() c] g-\fermata
\bar "empty";
- c, [c_"rubato" e g c]
+ c, ~ [c^\turn_"rubato" e g c]
e4. e8 [g () f_"rit" e d]
dis4() e4
\bar "" ;
r8 a [b cis]
+% \grace e16
[d16 cis d e]
- f4( [ )f16 e d c]
+ f4 ~ [f16 e d c]
b4-\turn
\times 2/3 { [ d8 c8 a8] }
- g2
+ g2~
\bar "" ;
[g16 c, e g] [c e, g c]
[e g, c e] g4^\fermata
[g8.(_"a tempo" e16 g8. )e16]
a4. g8 [f8 e8 d8 c8]
g2 d'2-\trill
- c4
- }}
+% \grace { [c32 d] }
+ c4
+ } }
+
\score {
\notes { \cad }
- \midi { \tempo 4 = 90; }
\paper {
}
+ \midi { \tempo 4 = 90; }
}
((null? alist) #t)
(set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
+
+;;;; print a SCM expression. Isn't this part of the std lib?
+
+(define (scmlist->string exp)
+ (cond
+ ((pair? (cdr exp)) (string-append (scm->string (car exp)) " " (scmlist->string (cdr exp))))
+ ((eq? '() (cdr exp)) (string-append (scm->string (car exp)) ")"))
+ (else (string-append (scm->string (car exp)) " . " (scm->string (cdr exp)) ")"))
+ ))
+
+(define (scm->string exp)
+ (cond
+ ((pair? exp) (string-append "(" (scmlist->string exp)))
+ ((number? exp) (number->string exp))
+ ((symbol? exp) (symbol->string exp))
+ ((string? exp) (string-append "\"" exp "\""))
+ ))
+
+(define (test-scm->string)
+(list (scmlist->string '(a))
+(scmlist->string '(a b))
+(scmlist->string '(a b . c))
+
+
+(scm->string '(a))
+(scm->string '(a b ))
+(scm->string '(a b . c))
+(scm->string '(a b (c . d)))
+(scm->string '(a "bla" (c . 1.5)))
+)
+)
def try_parse_grace_delims (str):
if str and str[0] == '{':
str = str[1:]
- sys.stderr.write ("warning: expanding grace notes\n")
- print '\\tiny '
+ print '\\grace { '
if str and str[0] == '}':
str = str[1:]
- print '\\normalsize '
+ print '}'
return str