From 47d53d531205815b538eb74e90ca5900e2acc7ad Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 14 Nov 2004 18:03:03 +0000 Subject: [PATCH] *** empty log message *** --- lily/context-property.cc | 3 -- lily/context-selector.cc | 68 ------------------------- lily/context.cc | 5 +- lily/grob-selector.cc | 87 -------------------------------- lily/include/context-selector.hh | 33 ------------ lily/include/grob-selector.hh | 34 ------------- lily/lily-parser.cc | 2 - lily/tweak-registration.cc | 2 +- 8 files changed, 2 insertions(+), 232 deletions(-) delete mode 100644 lily/context-selector.cc delete mode 100644 lily/grob-selector.cc delete mode 100644 lily/include/context-selector.hh delete mode 100644 lily/include/grob-selector.hh diff --git a/lily/context-property.cc b/lily/context-property.cc index 0e9a0e129a..e9f1a1ee06 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -206,9 +206,6 @@ make_item_from_properties (Engraver *tr, SCM x, SCM cause, const char * name) Item *it = new Item (props, key); scm_gc_unprotect_object (key->self_scm ()); -#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 deleted file mode 100644 index 2a90b8d3d8..0000000000 --- a/lily/context-selector.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - context-selector.cc -- implement Context selection. - - source file of the GNU LilyPond music typesetter - - (c) 2004 Jan Nieuwenhuizen -*/ - -#include "context-selector.hh" -#include "context.hh" -#include "scm-hash.hh" - -Scheme_hash_table *Context_selector::contexts_ = 0; - -void -Context_selector::register_context (Context *context) -{ - int count = 0; - if (Context *first = retrieve_context (identify_context (context, 0))) - { - count = robust_scm2int (first->get_property ("tweakCount"), 0); - count++; - SCM s = scm_int2num (count); - first->set_property ("tweakCount", s); - context->set_property ("tweakRank", s); - } - /* 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); -} - -SCM -Context_selector::identify_context (Context *context, int count) -{ - /* TODO: start time, parent-context-at-start */ - return scm_list_3 (scm_makfrom0str (context->context_name ().to_str0 ()), - scm_makfrom0str (context->id_string ().to_str0 ()), - scm_int2num (count)); -} - -SCM -Context_selector::identify_context (Context *context) -{ - return - identify_context (context, - robust_scm2int (context->get_property ("tweakRank"), 0)); -} - -void -Context_selector::store_context (SCM context_id, Context *context) -{ - contexts_->set (ly_to_symbol (context_id), context->self_scm ()); -} - -Context * -Context_selector::retrieve_context (SCM context_id) -{ - return unsmob_context (contexts_->get (ly_to_symbol (context_id))); -} - -void -Context_selector::set_tweaks (SCM tweaks) -{ - (void) tweaks; - contexts_ = new Scheme_hash_table (); - //tweaks_ = tweaks; -} - diff --git a/lily/context.cc b/lily/context.cc index c06b9288ca..82eaba0adf 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -9,7 +9,6 @@ #include "object-key.hh" #include "context-def.hh" -#include "context-selector.hh" #include "context.hh" #include "ly-smobs.icc" #include "main.hh" @@ -65,9 +64,7 @@ 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 deleted file mode 100644 index bc45d90103..0000000000 --- a/lily/grob-selector.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - grob-selector.cc -- implement Grob selection. - - source file of the GNU LilyPond music typesetter - - (c) 2004 Jan Nieuwenhuizen -*/ - -#include "context-selector.hh" -#include "context.hh" -#include "grob-selector.hh" -#include "grob.hh" -#include "paper-column.hh" -#include "scm-hash.hh" -#include "warn.hh" - -Scheme_hash_table *Grob_selector::grobs_ = 0; -Protected_scm Grob_selector::tweaks_ = SCM_EOL; - -void -Grob_selector::register_grob (Context *context, Grob *grob) -{ - int count = 0; - Moment m = context->now_mom (); - if (Grob *first = retrieve_grob (identify_grob (context, m, grob, 0))) - { - count = robust_scm2int (first->get_property ("tweak-count"), 0); - count++; - SCM s = scm_int2num (count); - 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); - 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)); -} - -SCM -Grob_selector::identify_grob (Context *context, Moment m, Grob *grob, int count) -{ - return scm_list_4 (Context_selector::identify_context (context), - scm_makfrom0str (m.to_string ().to_str0 ()), - scm_makfrom0str (grob->name ().to_str0 ()), - scm_int2num (count)); -} - -SCM -Grob_selector::identify_grob (Grob *grob) -{ - Moment m; - return identify_grob (unsmob_context (grob->get_property ("context")), - Paper_column::when_mom (((Item*) grob)->get_column ()), - grob, - robust_scm2int (grob->get_property ("tweak-rank"), 0)); -} - -void -Grob_selector::store_grob (SCM grob_id, Grob *grob) -{ - grobs_->set (ly_to_symbol (grob_id), grob->self_scm ()); -} - -Grob * -Grob_selector::retrieve_grob (SCM grob_id) -{ - return unsmob_grob (grobs_->get (ly_to_symbol (grob_id))); -} - -void -Grob_selector::set_tweaks (SCM tweaks) -{ - grobs_ = new Scheme_hash_table (); - tweaks_ = tweaks; -} - -LY_DEFINE (ly_grob_id, "ly:grob-id", - 1, 0, 0, (SCM grob_scm), - "Return grob id.") -{ - Grob *grob = unsmob_grob (grob_scm); - SCM_ASSERT_TYPE (grob, grob_scm, SCM_ARG1, __FUNCTION__, "grob"); - return Grob_selector::identify_grob (grob); -} diff --git a/lily/include/context-selector.hh b/lily/include/context-selector.hh deleted file mode 100644 index b18ebd13c0..0000000000 --- a/lily/include/context-selector.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - context-selector.hh -- declare Context_selector - - source file of the LilyPond music typesetter - - (c) 2004 Jan Nieuwenhuizen -*/ -#ifndef CONTEXT_SELECTOR_HH -#define CONTEXT_SELECTOR_HH - -#include "lily-guile.hh" -#include "lily-proto.hh" - -/** - * Context_selector: - * @register_context: register new #CONTEXT. - # - **/ -class Context_selector -{ - static Scheme_hash_table *contexts_; - -public: - static void register_context (Context *context); - static SCM identify_context (Context *context, int count); - static SCM identify_context (Context *context); - static Context *retrieve_context (SCM context_id); - static void store_context (SCM context_id, Context *context); - static void set_tweaks (SCM tweaks); -}; - -#endif /* CONTEXT_SELECTOR_HH */ - diff --git a/lily/include/grob-selector.hh b/lily/include/grob-selector.hh deleted file mode 100644 index a235ef3ea0..0000000000 --- a/lily/include/grob-selector.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* - grob-selector.hh -- declare Grob_selector - - source file of the LilyPond music typesetter - - (c) 2004 Jan Nieuwenhuizen -*/ -#ifndef GROB_SELECTOR_HH -#define GROB_SELECTOR_HH - -#include "lily-guile.hh" -#include "lily-proto.hh" -#include "protected-scm.hh" - -/** - * Grob_selector: - * @register_grob: register new #GROB. - # - **/ -class Grob_selector -{ - static Scheme_hash_table *grobs_; - static Protected_scm tweaks_; - -public: - static void register_grob (Context *context, Grob *grob); - static SCM identify_grob (Context *context, Moment m, Grob *grob, int count); - static SCM identify_grob (Grob *grob); - static Grob *retrieve_grob (SCM grob_id); - static void store_grob (SCM grob_id, Grob *grob); - static void set_tweaks (SCM tweaks); -}; - -#endif /* GROB_SELECTOR_HH */ diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 1f031bcce8..8d1c582c89 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -10,8 +10,6 @@ #include "book.hh" #include "lilypond-key.hh" -#include "context-selector.hh" -#include "grob-selector.hh" #include "file-name.hh" #include "file-path.hh" #include "lily-version.hh" diff --git a/lily/tweak-registration.cc b/lily/tweak-registration.cc index ae8482941a..7f929b0a10 100644 --- a/lily/tweak-registration.cc +++ b/lily/tweak-registration.cc @@ -121,7 +121,7 @@ Tweak_registry * global_registry_; void init_global_tweak_registry() { - global_registry_ = new Tweak_registry(); + // global_registry_ = new Tweak_registry(); } ADD_SCM_INIT_FUNC(init_global_tweak_registry,init_global_tweak_registry); -- 2.39.5