]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/grob-scheme.cc (LY_DEFINE): new function ly:grob-set-callback!
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 12:36:43 +0000 (12:36 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 12:36:43 +0000 (12:36 +0000)
* lily/grob-property.cc (set_callback): new function.

* lily/script-engraver.cc (make_script_from_event): don't trigger callback.

* lily/grob-property.cc (try_callback): remove marker if applicable.

* lily/include/grob.hh: remove Grob_status.

* lily/grob-property.cc (get_property_data): new function:
(try_callback): new function.

lily/grob-property.cc
lily/grob-scheme.cc
lily/include/grob.hh
lily/script-engraver.cc

index b1689fd3caf00690311f297779c3c0d3048eb2f5..0513299cd83c48264ccc9c8b3f46b9f2ae60304f 100644 (file)
@@ -223,6 +223,21 @@ Grob::internal_set_object (SCM s, SCM v)
   object_alist_ = scm_assq_set_x (object_alist_, s, v);
 }
 
+void
+Grob::set_callback (SCM s, SCM v)
+{
+  /* Perhaps we simply do the assq_set, but what the heck. */
+  if (!is_live ())
+    return;
+
+  /*
+    property_callbacks_ is r/o in principle, so we tack it in front.
+   */ 
+  property_callbacks_ = scm_acons (s,v, property_callbacks_);
+}
+
+
+
 SCM
 Grob::internal_get_object (SCM sym) const
 {
index bc561caf9657017510f322af8b38baa99df78ded..5626914b9121c159a9c93a041d2fcf0dcb804df9 100644 (file)
 #include "system.hh"
 #include "font-interface.hh"
 
+
+LY_DEFINE (ly_grob_set_callback_x, "ly:grob-set-callback!",
+          3, 0, 0, (SCM grob, SCM sym, SCM proc),
+          "Set @var{sym} in grob @var{grob} to value @var{proc}")
+{
+  Grob *sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+  SCM_ASSERT_TYPE (ly_is_procedure (val), val, SCM_ARG3, __FUNCTION__, "procedure");
+
+  sc->set_callback (sym, val);
+  return SCM_UNSPECIFIED;
+}
+
 LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!",
           3, 0, 0, (SCM grob, SCM sym, SCM val),
           "Set @var{sym} in grob @var{grob} to value @var{val}")
index 21ad403a170c9fbecd0e9cf8545c97c4d2edbd71..7a74d8baee991071ee093ab864e543134622c867 100644 (file)
@@ -119,6 +119,7 @@ public:
   Grob *common_refpoint (Grob const *s, Axis a) const;
 
   // duh. slim down interface here. (todo)
+  void set_callback (SCM sym, SCM proc);
   bool has_offset_callback (SCM callback, Axis) const;
   void add_offset_callback (SCM callback, Axis);
   bool has_extent_callback (SCM, Axis) const;
index fdacff1079619d1b318e92e4d2108ed9805eb131..26d72f361deba3737a82b79ace6b38c9f5a3a2ca 100644 (file)
@@ -211,8 +211,8 @@ Script_engraver::acknowledge_note_column (Grob_info info)
      swapped around horizontally.
 
      As the note head to put it on is not known now, postpone this
-     decision to Script_interface::before_line_breaking ().  */
-
+     decision to Script_interface::calc_direction ().  */
+  */
   for (int i = 0; i < scripts_.size (); i++)
     {
       Grob *e = scripts_[i].script_;