[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Align metronome mark at time signature or first musical element. Fix
From: |
Jan Nieuwenhuizen |
Subject: |
Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041) |
Date: |
Sun, 29 Aug 2010 20:54:25 +0200 |
Op zondag 29-08-2010 om 18:04 uur [tijdzone +0000], schreef
address@hidden:
> http://codereview.appspot.com/1579041/diff/42001/43004#newcode109
> lily/metronome-engraver.cc:109: }
> this is out of style with the rest of lilypond code base.
>
> The normal pattern is to use XXx_interface::has_interface (for
> hard-coded interfaces), or grob->[internal_]has_interface(), to check
> for softcoded interfaces.
Thanks for catching this. I've applied the patch below.
Jan.
>From 19b37df119ff6ca84421d984fe1d33112ad08299 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Sun, 29 Aug 2010 20:51:49 +0200
Subject: [PATCH] Metronome mark: check for interface rather than grob name in
non-break-aligned.
This remove the usage of grob_name so so we can easily swap in and out
implementations of formatting behavior.
---
lily/metronome-engraver.cc | 19 ++++++-------------
scm/define-grob-properties.scm | 2 +-
scm/define-grobs.scm | 2 +-
3 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc
index 7eaf314..aed0275 100644
--- a/lily/metronome-engraver.cc
+++ b/lily/metronome-engraver.cc
@@ -99,24 +99,17 @@ Metronome_mark_engraver::acknowledge_break_aligned
(Grob_info info)
}
}
-SCM
-grob_name_scm (Grob *g)
-{
- SCM name_pair = scm_assq (ly_symbol2scm ("name"), g->get_property ("meta"));
- return (scm_is_pair (name_pair)
- ? ly_camel_case_2_lisp_identifier (scm_cdr (name_pair))
- : SCM_EOL);
-}
-
void
Metronome_mark_engraver::acknowledge_grob (Grob_info info)
{
Grob *g = info.grob ();
- if (text_
- && safe_is_member (grob_name_scm (g),
- text_->get_property ("non-break-align-symbols")))
- text_->set_parent (g, X_AXIS);
+ if (text_)
+ for (SCM s = text_->get_property ("non-break-align-symbols");
+ scm_is_pair (s);
+ s = scm_cdr (s))
+ if (g->internal_has_interface (scm_car (s)))
+ text_->set_parent (g, X_AXIS);
}
void
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index d4ee62b..4202b26 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -608,7 +608,7 @@ staff is crucial for @var{padding}).
@code{VerticalAlignment}; rather, place it using its own
@code{Y-offset} callback.")
(non-break-align-symbols ,list? "A list of symbols that determine
-which NON-break-aligned grobs to align this to.")
+which NON-break-aligned interfaces to align this to.")
(no-ledgers ,boolean? "If set, don't draw ledger lines on this
object.")
(no-stem-extend ,boolean? "If set, notes with ledger lines do not
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 38bd6eb..71a167d 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1171,7 +1171,7 @@
(list
ly:self-alignment-interface::x-aligned-on-self)))))
(self-alignment-X . ,LEFT)
(break-align-symbols . (key-signature time-signature))
- (non-break-align-symbols . (multi-measure-rest))
+ (non-break-align-symbols . (multi-measure-rest-interface))
(non-musical . #t)
(meta . ((class . Item)
(interfaces . (break-alignable-interface
--
1.7.0.4
1
--
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyOfSource.com | AvatarĀ® http://AvatarAcademy.nl
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), jan . nieuwenhuizen, 2010/08/24
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), n . puttock, 2010/08/25
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), n . puttock, 2010/08/26
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), jan . nieuwenhuizen, 2010/08/27
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), hanwenn, 2010/08/29
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041),
Jan Nieuwenhuizen <=
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), reinhold . kainhofer, 2010/08/29
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), hanwenn, 2010/08/29
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), n . puttock, 2010/08/29
- Re: Align metronome mark at time signature or first musical element. Fixes #684. (issue1579041), n . puttock, 2010/08/29