From e3e3dc3b08c55ee1ec5813ef0719365eac1e068d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 11 Nov 2004 20:43:17 +0000 Subject: [PATCH] * lily/context-property.cc (make_item_from_properties): * lily/context.cc (add_context)[TWEAK]: Tweak registration behind #ifdef. * scm/define-context-properties.scm (all-internal-translation-properties): Add tweakRank and tweakCount. * lily/grob.cc: * scm/define-grob-properties.scm (all-internal-grob-properties): Add tweak-rank and tweak-count. --- ChangeLog | 13 +++++++++++++ lily/context-property.cc | 3 ++- lily/context-selector.cc | 12 ++++++------ lily/context.cc | 3 ++- lily/grob-selector.cc | 10 ++++------ lily/grob.cc | 2 +- scm/define-context-properties.scm | 2 ++ scm/define-grob-properties.scm | 2 ++ 8 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37ef5bc981..b8385f2b83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-11-11 Jan Nieuwenhuizen + + * lily/context-property.cc (make_item_from_properties): + * lily/context.cc (add_context)[TWEAK]: Tweak registration behind + #ifdef. + + * scm/define-context-properties.scm + (all-internal-translation-properties): Add tweakRank and tweakCount. + + * lily/grob.cc: + * scm/define-grob-properties.scm (all-internal-grob-properties): + Add tweak-rank and tweak-count. + 2004-11-10 Jan Nieuwenhuizen * scm/output-gnome.scm (string->utf8-string, char->utf8-string): diff --git a/lily/context-property.cc b/lily/context-property.cc index 8d5923c132..d1e1c9f60d 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -202,8 +202,9 @@ make_item_from_properties (Translator *tr, SCM x, SCM cause) SCM props = updated_grob_properties (context, x); Item *it = new Item (props); +#ifdef TWEAK Grob_selector::register_grob (context, it); - +#endif dynamic_cast(tr)->announce_grob (it, cause); return it; diff --git a/lily/context-selector.cc b/lily/context-selector.cc index c9d34a727f..fa583e91a9 100644 --- a/lily/context-selector.cc +++ b/lily/context-selector.cc @@ -20,14 +20,14 @@ Context_selector::register_context (Context *context) int count = 0; if (Context *first = retrieve_context (identify_context (context, 0))) { - count = robust_scm2int (first->get_property ("max"), 0); + count = robust_scm2int (first->get_property ("tweakCount"), 0); count++; SCM s = scm_int2num (count); - first->set_property ("max", s); - context->set_property ("count", s); + first->set_property ("tweakCount", s); + context->set_property ("tweakRank", s); } - /* FIXME: must alway set count, for get_property () not to segfault. */ - context->set_property ("count", scm_int2num (count)); + /* FIXME: must alway set rank, for get_property () not to segfault. */ + context->set_property ("tweakRank", scm_int2num (count)); store_context (identify_context (context, count), context); } @@ -45,7 +45,7 @@ Context_selector::identify_context (Context *context) { return identify_context (context, - robust_scm2int (context->get_property ("count"), 0)); + robust_scm2int (context->get_property ("tweakRank"), 0)); } void diff --git a/lily/context.cc b/lily/context.cc index 3dd2c482e2..f53b319799 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -63,8 +63,9 @@ Context::add_context (Context *t) if (!t->init_) { t->init_ = true; +#ifdef TWEAK Context_selector::register_context (t); - +#endif scm_gc_unprotect_object (ts); Context_def *td = unsmob_context_def (t->definition_); diff --git a/lily/grob-selector.cc b/lily/grob-selector.cc index 3742b1f5f2..3758133e73 100644 --- a/lily/grob-selector.cc +++ b/lily/grob-selector.cc @@ -26,21 +26,19 @@ Grob_selector::register_grob (Context *context, Grob *grob) Moment m = context->now_mom (); if (Grob *first = retrieve_grob (identify_grob (context, m, grob, 0))) { - count = robust_scm2int (first->get_property ("max"), 0); + count = robust_scm2int (first->get_property ("tweak-count"), 0); count++; SCM s = scm_int2num (count); - first->set_property ("max", s); - grob->set_property ("count", s); + first->set_property ("tweak-count", s); + grob->set_property ("tweak-rank", s); } grob->set_property ("context", context->self_scm ()); SCM grob_id = identify_grob (context, m, grob, count); store_grob (grob_id, grob); -#ifdef TWEAK SCM tweak = ly_assoc_get (grob_id, tweaks_, SCM_BOOL_F); if (tweak != SCM_BOOL_F) grob->set_property (ly_symbol2string (scm_car (tweak)).to_str0 (), scm_cadr (tweak)); -#endif } SCM @@ -59,7 +57,7 @@ Grob_selector::identify_grob (Grob *grob) return identify_grob (unsmob_context (grob->get_property ("context")), Paper_column::when_mom (((Item*) grob)->get_column ()), grob, - robust_scm2int (grob->get_property ("count"), 0)); + robust_scm2int (grob->get_property ("tweak-rank"), 0)); } void diff --git a/lily/grob.cc b/lily/grob.cc index 0fd567d566..7786f4d3b1 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -712,7 +712,7 @@ ADD_INTERFACE (Grob, "grob-interface", "context staff-symbol interfaces dependencies X-extent Y-extent extra-X-extent " "meta layer before-line-breaking-callback " "after-line-breaking-callback extra-Y-extent minimum-X-extent " - "minimum-Y-extent transparent " + "minimum-Y-extent transparent tweak-count tweak-rank" ); diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 247cf7932b..d41d0797b3 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -494,6 +494,8 @@ event types that should be duplicated for @code{\\quote} commands.") (instrumentSupport ,grob-list? "list of grobs to attach instrument name to.") (tieMelismaBusy ,boolean? "Signal whether a tie is present.") + (tweakCount ,number? "Number of otherwise unique Contexts.") + (tweakRank ,number? "Identify otherwise unique Contexts.") ) )) diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index d38ce94d10..757d91279f 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -527,6 +527,8 @@ function is to protect objects from being garbage collected.") (center-element ,ly:grob? "grob which will be at the center of the group after aligning (when using Align_interface::center_on_element).") + (tweak-count ,number? "Number of otherwise unique Grobs.") + (tweak-rank ,number? "Identify otherwise unique Grobs.") (direction-source ,ly:grob? "in case side-relative-direction is set, which grob to get the direction from .") (dot ,ly:grob? "reference to Dots object.") -- 2.39.2