Item *it = new Item (props, key);
scm_gc_unprotect_object (key->self_scm ());
-#ifdef TWEAK
- Grob_selector::register_grob (context, it);
-#endif
dynamic_cast<Engraver*>(tr)->announce_grob (it, cause);
return it;
+++ /dev/null
-/*
- context-selector.cc -- implement Context selection.
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#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;
-}
-
#include "object-key.hh"
#include "context-def.hh"
-#include "context-selector.hh"
#include "context.hh"
#include "ly-smobs.icc"
#include "main.hh"
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_);
+++ /dev/null
-/*
- grob-selector.cc -- implement Grob selection.
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#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);
-}
+++ /dev/null
-/*
- context-selector.hh -- declare Context_selector
-
- source file of the LilyPond music typesetter
-
- (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-#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 */
-
+++ /dev/null
-/*
- grob-selector.hh -- declare Grob_selector
-
- source file of the LilyPond music typesetter
-
- (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-#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 */
#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"
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);