2003-07-17 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * lily/translator-scheme.cc (LY_DEFINE): bugfix: always return
+ something.
+
* make/lilypond.redhat.spec.in (Group): change ftp.cs.uu.nl to
ftp.lilypond.org everywhere.
@subsection Red Hat Linux
-Red Hat 7.x i386 RPMS are available from
-@uref{ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/binaries/}. For running on
-a Red Hat system you need these packages: guile, tetex, tetex-latex,
-tetex-dvips, libstdc++, python, ghostscript.
-You can also compile them yourself. A spec file is in
+You can compile RPMS yourself. For running on a Red Hat system you
+need these packages: guile, tetex, tetex-latex, tetex-dvips,
+libstdc++, python, ghostscript. A spec file is in
@file{make/out/lilypond.redhat.spec}. This file is distributed along
with the sources. You can make the rpm by issuing
@example
libstdc++-devel, guile-devel, flex, bison, texinfo, groff, mftrace,
netpbm-progs, autotrace, t1utils.
-
-
-@subsection LinuxPPC
-
-
-Some LinuxPPC RPMS should available from
-@uref{ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/binaries/}.
-
-A LinuxPPC RPM can be made using the @file{lilypond.redhat.spec} file.
-
@subsection SuSE
Some SUSE RPMS should available from
STEPMAKE_INIT
# List a file that identifies your package.
-## huh, lsm.in silently [re]moved?
-##AC_CONFIG_SRCDIR([make/lilypond.lsm.in])
AC_CONFIG_SRCDIR([lily/main.cc])
+
# Move to aclocal.m4?
AC_CONFIG_HEADER([$CONFIGFILE.h:config.hh.in])
#include "note-column.hh"
#include "group-interface.hh"
-class Cluster_engraver : public Engraver
+class Cluster_spanner_engraver : public Engraver
{
protected:
-TRANSLATOR_DECLARATIONS(Cluster_engraver);
+ TRANSLATOR_DECLARATIONS(Cluster_spanner_engraver);
virtual bool try_music (Music *);
virtual void process_music ();
virtual void acknowledge_grob (Grob_info);
virtual void stop_translation_timestep ();
-
+ virtual void finalize ();
private:
- Drul_array<Music*> reqs_drul_;
+ Link_array<Music> cluster_notes_;
+ Item* beacon_;
- Spanner *cluster_;
+ void typeset_grobs ();
+ Spanner *spanner_;
+ Spanner * finished_spanner_ ;
};
-Cluster_engraver::Cluster_engraver ()
+Cluster_spanner_engraver::Cluster_spanner_engraver ()
+{
+ spanner_ = 0;
+ finished_spanner_ = 0;
+ beacon_ = 0;
+}
+
+void
+Cluster_spanner_engraver::finalize ()
{
- cluster_ = 0;
- reqs_drul_[LEFT] = reqs_drul_[RIGHT] = 0;
+ typeset_grobs ();
+ finished_spanner_ = spanner_;
+ spanner_ = 0;
+ typeset_grobs ();
+}
+
+void
+Cluster_spanner_engraver::typeset_grobs ()
+{
+ if (finished_spanner_ )
+ {
+ typeset_grob (finished_spanner_);
+ finished_spanner_ = 0;
+ }
+
+ if (beacon_)
+ {
+ typeset_grob (beacon_);
+ beacon_ = 0;
+ }
}
bool
-Cluster_engraver::try_music (Music *m)
+Cluster_spanner_engraver::try_music (Music *m)
{
if (m->is_mus_type ("abort-event"))
{
- reqs_drul_[START] = 0;
- reqs_drul_[STOP] = 0;
- if (cluster_)
+ if (spanner_)
{
- cluster_->suicide ();
- cluster_ = 0;
+ spanner_->suicide ();
+ spanner_ = 0;
}
}
- else if (m->is_mus_type ("cluster-event"))
+ else if (m->is_mus_type ("cluster-note-event"))
{
- Direction d = to_dir (m->get_mus_property ("span-direction"));
-
- reqs_drul_[d] = m;
+ cluster_notes_.push (m);
return true;
}
return false;
}
void
-Cluster_engraver::process_music ()
+Cluster_spanner_engraver::process_music ()
{
- if (reqs_drul_[STOP])
+ if (cluster_notes_.size())
{
- if (!cluster_)
- {
- reqs_drul_[STOP]->origin ()->warning ("can't find start of cluster");
- }
- else
+ SCM c0scm = get_property ("centralCPosition");
+
+ int c0 = gh_number_p (c0scm) ? gh_scm2int (c0scm) : 0;
+ int pmax = INT_MIN;
+ int pmin = INT_MAX;
+
+ for (int i = 0; i <cluster_notes_.size (); i++)
{
- Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
- cluster_->set_bound (RIGHT, bound);
+ Pitch *pit =unsmob_pitch (cluster_notes_[i]->get_mus_property ("pitch"));
+
+ int p =( pit ? pit->steps () : 0) + c0;
+
+ pmax = pmax >? p;
+ pmin = pmin <? p;
}
+
+ Item *it = new Item (get_property ("ClusterSpannerBeacon"));
+ it->set_grob_property ("positions", scm_cons (gh_int2scm (pmin),
+ gh_int2scm (pmax)));
+
+ }
+
+ if (beacon_ && !spanner_)
+ {
+ spanner_ = new Spanner (get_property ("Cluster"));
+ announce_grob (spanner_, cluster_notes_[0]->self_scm ());
}
- if (reqs_drul_[START])
+
+ if (beacon_ && spanner_)
{
- if (cluster_)
- {
- reqs_drul_[START]->origin ()->warning ("may not nest clusters");
- }
- else
- {
- cluster_ = new Spanner (get_property ("Cluster"));
- Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
- cluster_->set_bound (LEFT, bound);
- announce_grob (cluster_, reqs_drul_[START]->self_scm ());
- }
- reqs_drul_[START] = 0;
+ add_bound_item (spanner_, beacon_);
+ Pointer_group_interface::add_grob (spanner_, ly_symbol2scm ("columns"), beacon_);
}
}
void
-Cluster_engraver::stop_translation_timestep ()
+Cluster_spanner_engraver::stop_translation_timestep ()
{
- if (reqs_drul_[STOP])
- {
- reqs_drul_[STOP] = 0;
- typeset_grob (cluster_);
- cluster_ = 0;
- }
+ typeset_grobs ();
+
+ cluster_notes_.clear();
+
}
void
-Cluster_engraver::acknowledge_grob (Grob_info info)
+Cluster_spanner_engraver::acknowledge_grob (Grob_info info)
{
- if (cluster_ && Note_column::has_interface (info.grob_))
+ if (!beacon_ && Note_column::has_interface (info.grob_))
{
- Pointer_group_interface::add_grob (cluster_, ly_symbol2scm ("columns"), info.grob_);
+ finished_spanner_ = spanner_;
+ spanner_ = 0;
}
}
-ENTER_DESCRIPTION(Cluster_engraver,
-/* descr */ "engraves a cluster",
+ENTER_DESCRIPTION(Cluster_spanner_engraver,
+/* descr */ "Engraves a cluster using Spanner notation ",
/* creats*/ "Cluster",
-/* accepts */ "cluster-event",
+/* accepts */ "cluster-note-event abort-event",
/* acks */ "note-column-interface",
/* reads */ "",
/* write */ "");
Grob *common = left_bound->common_refpoint (right_bound, X_AXIS);
SCM cols =me->get_grob_property ("columns");
+
if (!gh_pair_p (cols))
{
me->warning ("junking empty cluster");
for (SCM s = cols; gh_pair_p (s); s = ly_cdr (s))
{
Grob * col = unsmob_grob (ly_car (s));
- Slice s = Note_column::head_positions_interval (col);
- Grob * h = Note_column::first_head (col);
- Real x = h->relative_coordinate (common, X_AXIS) - left_coord;
+ SCM posns = col->get_grob_property ("positions");
+
+ Slice s (0,0);
+ if (ly_number_pair_p (posns))
+ s = Slice (gh_scm2int (gh_car (posns)),
+ gh_scm2int (gh_cdr (posns)));
+
+ Real x = col->relative_coordinate (common, X_AXIS) - left_coord;
bottom_points.push (Offset (x, s[DOWN] *0.5));
top_points.push (Offset (x, s[UP] * 0.5));
}
if (gh_pair_p (cols))
{
Grob * col = unsmob_grob (ly_car (scm_last_pair (cols)));
- Slice s = Note_column::head_positions_interval (col);
+ SCM posns = col->get_grob_property ("positions");
+
+ Slice s (0,0);
+ if (ly_number_pair_p (posns))
+ s = Slice (gh_scm2int (gh_car (posns)),
+ gh_scm2int (gh_cdr (posns)));
+
Real x = right_bound->relative_coordinate (common,X_AXIS) - left_coord;
bottom_points.insert (Offset (x, s[DOWN] * 0.5),0);
tr = tr->where_defined (name);
+
if (tr)
- return tr? tr->self_scm(): SCM_EOL;
+ return tr->self_scm();
+
+ return SCM_EOL;
}
LY_DEFINE(ly_unset_context_property,
\consists "Script_column_engraver"
\consists "Rhythmic_column_engraver"
\consists "Phrasing_slur_engraver"
- \consists "Cluster_engraver"
+ \consists "Cluster_spanner_engraver"
\consists "Slur_engraver"
\consists "Tie_engraver"
\consists "New_tie_engraver"
\version "1.7.18"
-startCluster = #(make-span-event 'ClusterEvent START)
-stopCluster = #(make-span-event 'ClusterEvent STOP)
-
startGroup = #(make-span-event 'NoteGroupingEvent START)
stopGroup = #(make-span-event 'NoteGroupingEvent STOP)
"Note name"
'(style))
+
+(ly:add-interface
+ 'cluster-beacon-interface
+
+ "A place holder for the cluster spanner to determine the vertical
+extents of a cluster spanner at this X position.
+
+ "
+ '(positions)
+ )
+
(ly:add-interface
'dynamic-interface
"Any kind of loudness sign"
'()
)
-(ly:add-interface
- 'rhythmic-grob-interface
- "Any object with a rhythmic basis. Used to determine which grobs
-are interesting enough to maintain a hara-kiri staff."
- '()
- )
-
(ly:add-interface
'ligature-interface
"A ligature"
'(
))
+(ly:add-interface
+ 'rhythmic-grob-interface
+ "Any object with a rhythmic basis. Used to determine which grobs
+are interesting enough to maintain a hara-kiri staff."
+ '()
+ )
;;; todo: this is not typesetting info. Move to interpretation.
(ly:add-interface
'tablature-interface
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(meta . ((interfaces . (clef-interface staff-symbol-referencer-interface font-interface break-aligned-interface item-interface ))))
))
-
+
+ (ClusterSpannerBeacon
+ . (
+ (molecule-callback . #f)
+ (meta . ((interfaces . (cluster-beacon-interface item-interface))))
+ ))
+
(Cluster
. (
(molecule-callback . ,Cluster::brew_molecule)
(internal-class-name . "Event")
(types . (general-music event busy-playing-event))
))
- (ClusterEvent
+ (ClusterNoteEvent
. (
- (description . "Begins or ends a cluster.")
+ (description . "A note that is part of a cluster.")
(internal-class-name . "Event")
- (types . (general-music cluster-event span-event event))
- ))
+ (types . (general-music note-event cluster-note-event melodic-event rhythmic-event event))
+ ))
(ContextSpeccedMusic
. (
(description . "Interpret the argument music within a specific context.")
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (shift-one-duration-log music shift dot)
music))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; clusters.
+
+(define-public (note-to-cluster music)
+ "Replace NoteEvents by ClusterNoteEvents."
+ (if (eq? (ly:get-mus-property music 'name) 'NoteEvent)
+ (let* ((cn (make-music-by-name 'ClusterNoteEvent)))
+
+ (ly:set-mus-property! cn 'pitch (ly:get-mus-property music 'pitch))
+ (ly:set-mus-property! cn 'duration (ly:get-mus-property music 'duration))
+ cn)
+ music))
+(define-public (notes-to-cluster music)
+ (music-map note-to-cluster music))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; repeats.
verbose_p = 0
remove_previous_p = 0
-url = 'file:/home/ftp/pub/gnu/LilyPond/development/lilypond-*.tar.gz'
-url = 'ftp://appel.lilypond.org/pub/gnu/LilyPond/development/lilypond-*.tar.gz'
-url = 'ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/development/lilypond-*.tar.gz'
+#url = 'file:/home/ftp/pub/gnu/LilyPond/development/lilypond-*.tar.gz'
+# url = 'ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/development/lilypond-*.tar.gz'
+url = 'ftp://ftp.lilypond.org/pub/LilyPond/development/lilypond-*.tar.gz'
build_root = os.path.join (os.environ ['HOME'], 'usr', 'src')