+pl6.jcn5
+ - repeatbars, volta-spanner work, alternative iteration still broken
+ - volta symbol
+
+pl5.szmulewicz2
+ - more GUILE stuff.
+ - tutorial doco updates
+
+pl6.jcn4
+ - volta-spanner
+ - repeat-engraver
+ - repeat/alternative music layout (hehe)
+
+pl6.uu1
+ - Doco of music iterators.
+********
+pl 6
pl5.szmulewicz1
- rtti stuff
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=1
-PATCH_LEVEL=6
+PATCH_LEVEL=7
MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
\consists "Key_engraver";
\consists "Local_key_engraver";
\consists "Time_signature_engraver";
+ \consists "Repeat_engraver";
\consists "Staff_symbol_engraver";
\consists "Collision_engraver";
\consists "Rest_collision_engraver";
\consists "Separating_line_group_engraver";
\name RhythmicStaff;
\consists "Bar_engraver";
+ \consists "Repeat_engraver";
\consists "Time_signature_engraver";
\consists "Staff_symbol_engraver";
\accepts "Voice";
\consists "Bar_engraver";
\consists "Clef_engraver";
+ \consists "Repeat_engraver";
\consists "Key_engraver";
\consists "Time_signature_engraver";
\consists "Local_key_engraver";
(string-append (number->string (cadr c)) " ")))
;;;;;;;; TeX
-; (define (tex action)
+;(define (tex action)
-(define
+(define
(beam-tex width slope thick)
(embedded-ps-tex (beam-ps width slope thick)))
(text-tex f s)
(string-append "\\set" f "{" s "}"))
+(define
+ (tuplet-tex dx dy dir)
+ (embedded-ps-tex (tuplet-ps dx dy dir)))
+
+(define
+ (volta-tex w last)
+ (embedded-ps-tex (volta-ps w last)))
;;;;;;;;;;;; PS
(string-append "(" s ") set" f " "))
+(define
+ (volta-ps w last)
+ (string-append
+ (numbers->string (list w (inexact->exact last)))
+ "draw_volta"))
+
;;; output definitions
(define
(numbers->string (list dx dy (inexact->exact dir)))
"draw_tuplet"))
-(define
- (tuplet-tex dx dy dir)
- (embedded-ps-tex (tuplet-ps dx dy dir)))
-
(define
(stem o kern width height depth)
((invoke-output o "stem") kern width height depth))
(startrepeat o h)
((invoke-output o "invoke-dim1") "startrepeat" h))
-
(define
(stop-line o)
((invoke-output o "stop-line")))
-
(define
(stoprepeat o h)
((invoke-output o "invoke-dim1") "stoprepeat" h))
+(define
+ (volta o w last)
+ ((invoke-output o "volta") w last))
--- /dev/null
+a b c d \repeat 2 { { c c c c d d d d } } \alternative { { e e e e } { e e e g } } c c c c c c c c
Atom text (String style, String text) const;
Atom vbrace (Real &dy) const;
Atom vbracket (Real &dy) const;
+ Atom volta (Real w, bool last_b) const;
Atom special_time_signature (String, Array<int>) const;
Atom time_signature (Array<int>) const;
--- /dev/null
+/*
+ repeat-engraver.hh -- declare Repeat_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef REPEAT_ENGRAVER_HH
+#define REPEAT_ENGRAVER_HH
+
+#include "engraver.hh"
+
+/**
+ Generate repeat-bars |: :| for repeated-music
+ */
+class Repeat_engraver : public Engraver
+{
+public:
+ Repeat_engraver ();
+ VIRTUAL_COPY_CONS(Translator);
+
+protected:
+ virtual void acknowledge_element (Score_element_info i);
+ virtual void do_removal_processing ();
+ virtual bool do_try_music (Music *req_l);
+ virtual void do_process_requests();
+ virtual void do_pre_move_processing();
+ virtual void do_post_move_processing();
+
+private:
+ Link_array<Repeated_music> repeated_music_arr_;
+ Link_array<Music> alternative_music_arr_;
+ Link_array<Bar> bar_p_arr_;
+ Link_array<Volta_spanner> volta_p_arr_;
+ Array<Moment> stop_mom_arr_;
+ Array<Moment> alternative_start_mom_arr_;
+ Array<Moment> alternative_stop_mom_arr_;
+};
+
+#endif // REPEAT_ENGRAVER_HH
+
--- /dev/null
+/*
+ volta-spanner.hh -- part of GNU LilyPond
+
+ (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef VOLTA_SPANNER_HH
+#define VOLTA_SPANNER_HH
+
+#include "text-def.hh"
+#include "pointer.hh"
+#include "directional-spanner.hh"
+
+/** Volta bracket with number */
+
+class Volta_spanner : public Directional_spanner
+{
+public:
+ Volta_spanner ();
+
+ void add_column (Note_column*);
+
+ P<Text_def> tdef_p_;
+ Link_array<Note_column> column_arr_;
+ bool last_b_;
+
+protected:
+ virtual Molecule* brew_molecule_p () const;
+ VIRTUAL_COPY_CONS(Score_element);
+
+ virtual void do_add_processing ();
+ virtual void do_post_processing ();
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
+};
+
+#endif // VOLTA_SPANNER_HH
+
// (lambda (o) (dashed-slur o thick dash '(stuff))
a.lambda_ =
- ly_append (ly_lambda_o (),
- gh_list (ly_append (ly_func_o ("dashed-slur"),
+ gh_append2 (ly_lambda_o (),
+ gh_list (gh_append2 (ly_func_o ("dashed-slur"),
gh_cons (gh_double2scm (thick),
gh_cons (gh_double2scm (dash),
gh_list (ly_quote_scm (gh_list (sc[1], sc[2], sc[3], sc[0], SCM_UNDEFINED)), SCM_UNDEFINED)))), SCM_UNDEFINED));
;
else
{
- if (afm_p)
+ int c = text[i];
+ if (afm_p && ((c >= 0) && (c < afm_p->char_metrics_.size ())))
{
- Adobe_font_char_metric m = afm_p->char_metrics_[(int)text[i]];
+ Adobe_font_char_metric m = afm_p->char_metrics_[c];
w += m.B_.x ().length ();
DOUT << to_str (m.B_.x ().length ()) << " ";
}
return a;
}
+Atom
+Lookup::volta (Real w, bool last_b) const
+{
+ Array<Real> arr;
+ arr.push (w);
+ arr.push (last_b);
+ Atom a;
+ a.lambda_ = (lambda_scm ("volta", arr));
+ a.str_ = "volta";
+ return a;
+}
--- /dev/null
+/*
+ repeat-engraver.cc -- implement Repeat_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "repeat-engraver.hh"
+#include "bar.hh"
+#include "musical-request.hh"
+#include "multi-measure-rest.hh"
+#include "command-request.hh"
+#include "time-description.hh"
+#include "engraver-group.hh"
+#include "repeated-music.hh"
+#include "time-description.hh"
+#include "volta-spanner.hh"
+#include "note-column.hh"
+
+ADD_THIS_TRANSLATOR (Repeat_engraver);
+
+Repeat_engraver::Repeat_engraver ()
+{
+}
+
+bool
+Repeat_engraver::do_try_music (Music* m)
+{
+ if (Repeated_music* r = dynamic_cast<Repeated_music *> (m))
+ {
+ repeated_music_arr_.push (r);
+ stop_mom_arr_.push (now_moment () + r->duration ());
+ // urg, something broken with alternative time...
+ //Moment alt_mom = now_moment () + r->repeat_p_->duration ();
+ Moment alt_mom = now_moment ();
+ for (PCursor<Music*> i (r->alternative_p_->music_p_list_p_->top ()); i.ok (); i++)
+ {
+ alternative_music_arr_.push (i.ptr ());
+ alternative_start_mom_arr_.push (alt_mom);
+ // urg, something broken with alternative time...
+ // alt_mom += i->duration ();
+ alt_mom += Moment (1);
+ alternative_stop_mom_arr_.push (alt_mom);
+ }
+ return true;
+ }
+ return false;
+}
+
+void
+Repeat_engraver::acknowledge_element (Score_element_info i)
+{
+ Moment now = now_moment ();
+ if (Note_column *nc = dynamic_cast<Note_column *> (i.elem_l_))
+ {
+ for (int i = 0; i < volta_p_arr_.size (); i++)
+ if ((now >= alternative_start_mom_arr_[i]) && volta_p_arr_[i])
+ volta_p_arr_[i]->add_column (nc);
+ }
+}
+
+void
+Repeat_engraver::do_removal_processing ()
+{
+ for (int i = 0; i < bar_p_arr_.size (); i++)
+ if (bar_p_arr_[i])
+ typeset_element (bar_p_arr_[i]);
+ for (int i = 0; i < volta_p_arr_.size (); i++)
+ if (volta_p_arr_[i])
+ typeset_element (volta_p_arr_[i]);
+}
+
+void
+Repeat_engraver::do_process_requests ()
+{
+ for (int i = bar_p_arr_.size (); i < repeated_music_arr_.size (); i++)
+ {
+ Bar* bar_p = new Bar;
+ bar_p-> type_str_ = "|:";
+ bar_p_arr_.push (bar_p);
+ announce_element (Score_element_info (bar_p, repeated_music_arr_[i]));
+ }
+ int bees = volta_p_arr_.size ();
+ for (int i = volta_p_arr_.size (); i < alternative_music_arr_.size (); i++)
+ {
+ Volta_spanner* v = new Volta_spanner;
+ if (i == alternative_music_arr_.size () - 1)
+ v->last_b_ = true;
+ Text_def* t = new Text_def;
+ t->text_str_ = to_str (i - bees + 1);
+ v->tdef_p_.set_p (t);
+ volta_p_arr_.push (v);
+ announce_element (Score_element_info (v, alternative_music_arr_[i]));
+ }
+}
+
+void
+Repeat_engraver::do_pre_move_processing ()
+{
+ for (int i = bar_p_arr_.size (); i--; )
+ {
+ if (bar_p_arr_[i])
+ {
+ typeset_element (bar_p_arr_[i]);
+ bar_p_arr_[i] = 0;
+ }
+ }
+}
+
+void
+Repeat_engraver::do_post_move_processing ()
+{
+ Moment now = now_moment ();
+ for (int i = bar_p_arr_.size (); i--; )
+ {
+ if (now >= stop_mom_arr_[i])
+ {
+ Bar* bar_p = new Bar;
+ bar_p-> type_str_ = ":|";
+ typeset_element (bar_p);
+ bar_p_arr_.del (i);
+ stop_mom_arr_.del (i);
+ repeated_music_arr_.del (i);
+ }
+ }
+ for (int i = volta_p_arr_.size (); i--; )
+ {
+ //if (now >= alternative_start_mom_arr_[i])
+ if (now >= alternative_stop_mom_arr_[i])
+ {
+ if (volta_p_arr_[i])
+ {
+ typeset_element (volta_p_arr_[i]);
+ volta_p_arr_[i] = 0;
+ }
+ }
+ }
+}
+
--- /dev/null
+/*
+ repeated-music-iterator.cc -- implement Repeated_music_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ */
+
+#include "repeated-music-iterator.hh"
+#include "repeated-music.hh"
+#include "musical-request.hh"
+#include "translator-group.hh"
+#include "command-request.hh"
+
+Repeated_music_iterator::Repeated_music_iterator ()
+{
+ repeat_iter_p_ = 0;
+ alternative_iter_p_ = 0;
+}
+
+Repeated_music_iterator::~Repeated_music_iterator ()
+{
+ delete repeat_iter_p_;
+ delete alternative_iter_p_;
+}
+
+void
+Repeated_music_iterator::do_print () const
+{
+ if (repeat_iter_p_) repeat_iter_p_->print ();
+ if (alternative_iter_p_) alternative_iter_p_->print ();
+}
+
+void
+Repeated_music_iterator::construct_children ()
+{
+ repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);
+}
+
+void
+Repeated_music_iterator::do_process_and_next (Moment m)
+{
+ if (first_b_)
+ {
+ bool success = report_to_l ()->try_music (repeated_music_l ());
+ if (!success)
+ music_l_->warning ( _("No one to print a volta bracket"));
+ }
+ if (repeat_iter_p_->ok ())
+ repeat_iter_p_->process_and_next (m);
+ else
+ {
+ if (!alternative_iter_p_)
+ {
+ delete repeat_iter_p_;
+ repeat_iter_p_ = 0;
+ alternative_iter_p_ = dynamic_cast<Sequential_music_iterator*>
+ (get_iterator_p (repeated_music_l ()->alternative_p_));
+ }
+ alternative_iter_p_->process_and_next (m);
+ }
+ Music_iterator::do_process_and_next (m);
+}
+
+Moment
+Repeated_music_iterator::next_moment () const
+{
+ if (repeat_iter_p_)
+ return repeat_iter_p_->next_moment ();
+ else if (alternative_iter_p_)
+ return alternative_iter_p_->next_moment ();
+ return 0;
+}
+
+bool
+Repeated_music_iterator::ok () const
+{
+ if (repeat_iter_p_)
+ return repeat_iter_p_->ok ();
+ else if (alternative_iter_p_)
+ return alternative_iter_p_->ok ();
+ return false;
+}
+
+Repeated_music*
+Repeated_music_iterator::repeated_music_l () const
+{
+ return (Repeated_music*)Music_iterator::music_l_;
+}
+
--- /dev/null
+/*
+ volta-spanner.cc -- implement Volta_spanner
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "atom.hh"
+#include "box.hh"
+#include "debug.hh"
+#include "lookup.hh"
+#include "molecule.hh"
+#include "note-column.hh"
+#include "p-col.hh"
+#include "paper-def.hh"
+#include "volta-spanner.hh"
+#include "stem.hh"
+#include "text-def.hh"
+
+/*
+ Hmm, should probably make generic Bracket_spanner,
+ or and derive Plet and volta spanner from that.
+ */
+
+Volta_spanner::Volta_spanner ()
+{
+ dir_ = UP;
+ last_b_ = false;
+ tdef_p_.set_p (new Text_def);
+ tdef_p_->align_dir_ = CENTER;
+ tdef_p_->style_str_ = "nummer";
+}
+
+Molecule*
+Volta_spanner::brew_molecule_p () const
+{
+ Molecule* mol_p = new Molecule;
+
+ if (column_arr_.size ()){
+ Real w = width ().length ();
+ Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_]
+ - column_arr_[0]->extent (Y_AXIS) [dir_];
+
+ Atom num (tdef_p_->get_atom (paper (), CENTER));
+ mol_p->add_atom (num);
+ mol_p->add_atom (lookup_l ()->volta (w, last_b_));
+ }
+ return mol_p;
+}
+
+void
+Volta_spanner::do_add_processing ()
+{
+ if (column_arr_.size ())
+ {
+ set_bounds (LEFT, column_arr_[0]);
+ set_bounds (RIGHT, column_arr_.top ());
+ }
+}
+
+void
+Volta_spanner::do_post_processing ()
+{
+ if (column_arr_.size())
+ translate_axis (column_arr_[0]->extent (Y_AXIS)[dir_], Y_AXIS);
+}
+
+void
+Volta_spanner::do_substitute_dependency (Score_element* o, Score_element* n)
+{
+ if (Note_column *onc = dynamic_cast <Note_column *> (o))
+ column_arr_.substitute (onc, dynamic_cast<Note_column*> (n));
+}
+
+void
+Volta_spanner::add_column (Note_column*n)
+{
+ column_arr_.push (n);
+ add_dependency (n);
+}
+
C 21; Character-21; B 0.00 0.00 5.24290 7.28178
C 22; Character-22; B 0.00 0.00 5.24290 5.95357
C 23; Character-23; B 0.00 0.00 7.86434 7.28178
-C 24; Character-24; B 0.00 0.00 4.66035 0
+C 24; Character-24; B 0.00 0.00 4.66035 0.0
C 25; Character-25; B 0.00 0.00 5.24291 7.28178
C 26; Character-26; B 0.00 0.00 7.57307 4.51470
C 27; Character-27; B 0.00 0.00 8.15562 4.51470
closepath fill
} bind def
-/draw_decrescendo % cont height width
+/draw_decrescendo % width height cons
{
stafflinethickness setlinewidth
/cresc_cont exch def
stroke
} bind def
-/draw_crescendo % cont height width
+/draw_crescendo % width height cons
{
stafflinethickness setlinewidth
/cresc_cont exch def
stroke
} bind def
+/draw_volta % w last
+{
+ /last exch def
+ /volta_w exch def
+ staffheight 2 div /volta_h exch def
+ volta_t setlinewidth
+ 0 0 moveto
+ 0 volta_h lineto
+ volta_w volta_h lineto
+ last 0 eq {
+ volta_w 0 lineto
+ } if
+ stroke
+} bind def
+
/draw_slur
{
stafflinethickness setlinewidth
50 /bracket_alpha exch def
staffheight 4 div /interline exch def
stafflinethickness 1.2 mul /tuplet_t exch def
+stafflinethickness 1.2 mul /volta_t exch def
1 setlinecap}
}