From 74125500ce35de91645294fb0db96b5413034f21 Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 17 Jul 2003 08:39:38 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 3 + Documentation/topdocs/INSTALL.texi | 18 +--- configure.in | 3 +- lily/cluster-engraver.cc | 138 ++++++++++++++++++----------- lily/cluster.cc | 20 ++++- lily/translator-scheme.cc | 5 +- ly/engraver-init.ly | 2 +- ly/spanners-init.ly | 3 - scm/define-grob-interfaces.scm | 24 +++-- scm/define-grobs.scm | 8 +- scm/define-music-types.scm | 8 +- scm/music-functions.scm | 15 +++- scripts/update-lily.py | 6 +- 13 files changed, 158 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index 640b5b3852..466d64f5df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,9 @@ 2003-07-17 Han-Wen Nienhuys + * 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. diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index 691dfbac45..136076112f 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -364,12 +364,10 @@ augroup @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 @@ -386,16 +384,6 @@ addition to the those needed for running: glibc-devel, gcc-c++, 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 diff --git a/configure.in b/configure.in index 8dd486c886..f70ea752a8 100644 --- a/configure.in +++ b/configure.in @@ -12,9 +12,8 @@ AC_CONFIG_AUX_DIR([stepmake/bin]) 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]) diff --git a/lily/cluster-engraver.cc b/lily/cluster-engraver.cc index 1263763f4b..9216241319 100644 --- a/lily/cluster-engraver.cc +++ b/lily/cluster-engraver.cc @@ -13,108 +13,140 @@ #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 reqs_drul_; + Link_array 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 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 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 */ ""); diff --git a/lily/cluster.cc b/lily/cluster.cc index 75346dbbac..c86adfdd84 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -147,6 +147,7 @@ Cluster::brew_molecule (SCM smob) 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"); @@ -164,10 +165,15 @@ Cluster::brew_molecule (SCM smob) 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)); } @@ -186,7 +192,13 @@ Cluster::brew_molecule (SCM smob) 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); diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index da08478fae..ad894342de 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -56,8 +56,11 @@ LY_DEFINE(ly_context_property_where_defined, 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, diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index a0039f92d2..69b3ce840c 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -186,7 +186,7 @@ VoiceContext = \translator { \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" diff --git a/ly/spanners-init.ly b/ly/spanners-init.ly index 08fe9534a7..1c448e4507 100644 --- a/ly/spanners-init.ly +++ b/ly/spanners-init.ly @@ -1,8 +1,5 @@ \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) diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index 25370f169a..dbc2cf4ed8 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -13,6 +13,17 @@ "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" @@ -25,13 +36,6 @@ '() ) -(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" @@ -55,6 +59,12 @@ are interesting enough to maintain a hara-kiri staff." '( )) +(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 diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 0532220a1b..b893f3b1d6 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -237,7 +237,13 @@ (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) diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index d0fdce20c8..1ff1c129ba 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -120,12 +120,12 @@ c8-[ c c-] c8") (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.") diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 8bffc5e52f..67056ef859 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -46,7 +46,6 @@ - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (shift-one-duration-log music shift dot) @@ -78,7 +77,21 @@ 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. diff --git a/scripts/update-lily.py b/scripts/update-lily.py index d90bc62c37..3030205055 100644 --- a/scripts/update-lily.py +++ b/scripts/update-lily.py @@ -44,9 +44,9 @@ keep_temp_dir_p = 0 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') -- 2.39.5