CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/10/16 01:25:47

Modified files:
        .              : ChangeLog 
        lily           : grob.cc rest.cc script-interface.cc system.cc 
                         volta-bracket.cc 
        lily/include   : grob.hh rest.hh 
        scm            : define-grob-properties.scm define-grobs.scm 

Log message:
        * lily/rest.cc (y_offset_callback): use offset callback
        iso. after-line-breaking callback.
        
        * lily/grob.cc: change after/before-line-breaking-callback to
        after/before-line-breaking dummy properties.
        
        * lily/include/grob.hh: remove Grob_status.
        
        * lily/grob.cc (other_axis_parent_positioning): new function.
        (same_axis_parent_positioning): new function
        
        * scm/define-grob-properties.scm (all-user-grob-properties): doc
        callbacks property.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4177&tr2=1.4178&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/grob.cc.diff?tr1=1.146&tr2=1.147&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/rest.cc.diff?tr1=1.98&tr2=1.99&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/script-interface.cc.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/system.cc.diff?tr1=1.122&tr2=1.123&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/volta-bracket.cc.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/grob.hh.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/rest.hh.diff?tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grob-properties.scm.diff?tr1=1.125&tr2=1.126&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.246&tr2=1.247&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4177 lilypond/ChangeLog:1.4178
--- lilypond/ChangeLog:1.4177   Sun Oct 16 01:06:18 2005
+++ lilypond/ChangeLog  Sun Oct 16 01:25:46 2005
@@ -1,5 +1,13 @@
 2005-10-16  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * lily/rest.cc (y_offset_callback): use offset callback
+       iso. after-line-breaking callback.
+
+       * lily/grob.cc: change after/before-line-breaking-callback to
+       after/before-line-breaking dummy properties.
+
+       * lily/include/grob.hh: remove Grob_status.
+
        * scm/define-context-properties.scm
        (all-user-translation-properties): remove verticalAlignmentChildCallback
 
Index: lilypond/lily/grob.cc
diff -u lilypond/lily/grob.cc:1.146 lilypond/lily/grob.cc:1.147
--- lilypond/lily/grob.cc:1.146 Sun Oct 16 01:06:19 2005
+++ lilypond/lily/grob.cc       Sun Oct 16 01:25:47 2005
@@ -165,9 +165,6 @@
   property_callbacks_ = s.property_callbacks_;
   object_alist_ = SCM_EOL;
 
-  /* No properties are copied.  That is the job of
-     handle_broken_dependencies.  */
-  status_ = s.status_;
   pscore_ = 0;
 
   smobify_self ();
@@ -209,36 +206,6 @@
   return pscore_ ? pscore_->layout () : 0;
 }
 
-/* Recursively track all dependencies of this Grob.  The status_ field
-   is used as a mark-field.  It is marked with BUSY during execution
-   of this function, and marked with FINAL when finished.
-
-   FUNCPTR is the function to call to update this element.  */
-void
-Grob::calculate_dependencies (int final, int busy, SCM funcname)
-{
-  if (status_ >= final)
-    return;
-
-  if (status_ == busy)
-    {
-      programming_error ("element is busy, come back later");
-      return;
-    }
-
-  status_ = busy;
-
-  extract_grob_set (this, "dependencies", deps);
-  for (int i = 0; i < deps.size (); i++)
-    deps[i]->calculate_dependencies (final, busy, funcname);
-
-  SCM proc = internal_get_property (funcname);
-  if (ly_is_procedure (proc))
-    scm_call_1 (proc, this->self_scm ());
-
-  status_ = final;
-}
-
 Stencil *
 Grob::get_stencil () const
 {
@@ -746,6 +713,9 @@
               "lists of other objects, or results from computations are stored 
in"
               "mutable properties: every call to set-grob-property (or its C++ 
equivalent) "
               "sets a mutable property. ",
+              "\n\n"
+              
+              "The properties @code{after-line-breaking} and 
@code{before-line-breaking} are unused dummies. "
 
               /* properties */
               "X-extent "
@@ -754,10 +724,10 @@
               "Y-extent "
               "Y-extent-callback "
               "Y-offset-callbacks "
-              "after-line-breaking-callback "
+              "after-line-breaking "
               "axis-group-parent-X "
               "axis-group-parent-Y "
-              "before-line-breaking-callback "
+              "before-line-breaking "
               "callbacks "
               "cause "
               "color "
Index: lilypond/lily/include/grob.hh
diff -u lilypond/lily/include/grob.hh:1.65 lilypond/lily/include/grob.hh:1.66
--- lilypond/lily/include/grob.hh:1.65  Sun Oct 16 01:06:19 2005
+++ lilypond/lily/include/grob.hh       Sun Oct 16 01:25:47 2005
@@ -14,15 +14,6 @@
 #include "grob-interface.hh"
 #include "object-key.hh"
 
-enum Grob_status
-  {
-    ORPHAN = 0, // not yet added to Paper_score
-    PRECALCING,
-    PRECALCED, // calcs before spacing done
-    POSTCALCING, // busy calculating. This is used to trap cyclic deps.
-    POSTCALCED, // after spacing calcs done
-  };
-
 typedef void (Grob:: *Grob_method_pointer) (void);
 
 class Grob
@@ -30,8 +21,6 @@
 private:
   DECLARE_SMOBS (Grob, foo);
   void init ();
-
-
 
 protected:
   Object_key const *key_;
Index: lilypond/lily/include/rest.hh
diff -u lilypond/lily/include/rest.hh:1.42 lilypond/lily/include/rest.hh:1.43
--- lilypond/lily/include/rest.hh:1.42  Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/rest.hh       Sun Oct 16 01:25:47 2005
@@ -16,7 +16,7 @@
 class Rest
 {
 public:
-  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM, SCM));
   static bool has_interface (Grob *);
   static String glyph_name (Grob *, int, String, bool);
   static SCM brew_internal_stencil (SCM, bool);
Index: lilypond/lily/rest.cc
diff -u lilypond/lily/rest.cc:1.98 lilypond/lily/rest.cc:1.99
--- lilypond/lily/rest.cc:1.98  Sat Aug 13 21:35:22 2005
+++ lilypond/lily/rest.cc       Sun Oct 16 01:25:47 2005
@@ -17,21 +17,25 @@
 #include "directional-element-interface.hh"
 
 // -> offset callback
-MAKE_SCHEME_CALLBACK (Rest, after_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Rest, y_offset_callback, 2);
 SCM
-Rest::after_line_breaking (SCM smob)
+Rest::y_offset_callback (SCM smob, SCM axis)
 {
   Grob *me = unsmob_grob (smob);
+  (void) axis;
+  
   int bt = scm_to_int (me->get_property ("duration-log"));
   int lc = Staff_symbol_referencer::line_count (me);
   Real ss = Staff_symbol_referencer::staff_space (me);
+
+  Real amount = 0.0;
   if (lc % 2)
     {
       if (bt == 0 && lc > 1)
-       me->translate_axis (ss, Y_AXIS);
+       amount += ss;
     }
   else
-    me->translate_axis (ss / 2, Y_AXIS);
+    amount += ss / 2;
 
   Grob *d = unsmob_grob (me->get_object ("dot"));
   if (d && bt > 4) // UGH.
@@ -44,7 +48,7 @@
       d->set_property ("staff-position",
                       scm_from_int ((bt == 0) ? -1 : 1));
     }
-  return SCM_UNSPECIFIED;
+  return scm_from_double (amount);
 }
 
 /*
Index: lilypond/lily/script-interface.cc
diff -u lilypond/lily/script-interface.cc:1.20 
lilypond/lily/script-interface.cc:1.21
--- lilypond/lily/script-interface.cc:1.20      Sun Oct 16 01:06:19 2005
+++ lilypond/lily/script-interface.cc   Sun Oct 16 01:25:47 2005
@@ -41,6 +41,9 @@
   return Stencil ();
 }
 
+/*
+todo: use proper callbacks.
+*/
 MAKE_SCHEME_CALLBACK (Script_interface, before_line_breaking, 1);
 SCM
 Script_interface::before_line_breaking (SCM smob)
Index: lilypond/lily/system.cc
diff -u lilypond/lily/system.cc:1.122 lilypond/lily/system.cc:1.123
--- lilypond/lily/system.cc:1.122       Tue Sep 27 11:33:28 2005
+++ lilypond/lily/system.cc     Sun Oct 16 01:25:47 2005
@@ -280,8 +280,10 @@
     apply_tweaks (all_elements_->grob (i), false);
 
   for (int i = 0; i < all_elements_->size (); i++)
-    all_elements_->grob (i)->calculate_dependencies (PRECALCED, PRECALCING,
-                                                    ly_symbol2scm 
("before-line-breaking-callback"));
+    {
+      Grob *g = all_elements_->grob (i);
+      (void) g->get_property ("after-line-breaking");
+    }
 
   message (_ ("Calculating line breaks..."));
   progress_indication (" ");
@@ -303,8 +305,7 @@
       Grob *g = all_elements_->grob (i);
 
       apply_tweaks (g, true);
-      g->calculate_dependencies (POSTCALCED, POSTCALCING,
-                                ly_symbol2scm 
("after-line-breaking-callback"));
+      (void) g->get_property ("after-line-breaking");
     }
 
   Interval iv (extent (this, Y_AXIS));
Index: lilypond/lily/volta-bracket.cc
diff -u lilypond/lily/volta-bracket.cc:1.54 lilypond/lily/volta-bracket.cc:1.55
--- lilypond/lily/volta-bracket.cc:1.54 Sun Oct 16 01:06:19 2005
+++ lilypond/lily/volta-bracket.cc      Sun Oct 16 01:25:47 2005
@@ -36,17 +36,6 @@
 Volta_bracket_interface::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
-
-  /*
-    UGH UGH  dependency tracking.
-  */
-  SCM proc = me->get_property ("after-line-breaking-callback");
-  if (ly_is_procedure (proc))
-    {
-      me->set_property ("after-line-breaking-callback", SCM_EOL);
-      scm_call_1  (proc, me->self_scm ());
-    }
-
   Spanner *orig_span = dynamic_cast<Spanner *> (me->original_);
   bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0]
                                            == (Spanner *)me);
Index: lilypond/scm/define-grob-properties.scm
diff -u lilypond/scm/define-grob-properties.scm:1.125 
lilypond/scm/define-grob-properties.scm:1.126
--- lilypond/scm/define-grob-properties.scm:1.125       Sun Oct 16 01:06:19 2005
+++ lilypond/scm/define-grob-properties.scm     Sun Oct 16 01:25:47 2005
@@ -84,9 +84,7 @@
 beaming patterns from stem to stem inside a beam.")
 
 
-     (before-line-breaking-callback ,procedure? "This procedure is
-called before line breaking, but after splitting breakable items at
-potential line breaks.")
+     (before-line-breaking ,boolean? "Dummy property, used to trigger a 
callback function.")
      (between-cols ,pair? "Where to attach a loose column to")
      (bound-padding ,number? "The amount of padding to insert around spanner 
bounds.")
      (bracket-flare ,number-pair? "A pair of numbers specifying how
@@ -529,7 +527,7 @@
      (axis-group-parent-Y ,ly:grob? "Containing Y axis group")
      (accidental-grobs ,list? "Alist with (NOTENAME . GROBLIST) entries")
      (adjacent-hairpins ,ly:grob-array? "List of directly neighboring 
hairpins")
-     (after-line-breaking-callback ,procedure? "This procedure is called after 
line breaking. Its return value is ignored.")     
+     (after-line-breaking ,boolean? "Dummy property, used to trigger callback 
for after-line-breaking")
      (all-elements ,ly:grob-array? "list of all grobs in this line. Its
 function is to protect objects from being garbage collected.")
      (arpeggio ,ly:grob? "pointer to arpeggio object.")
Index: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.246 lilypond/scm/define-grobs.scm:1.247
--- lilypond/scm/define-grobs.scm:1.246 Sun Oct 16 01:06:19 2005
+++ lilypond/scm/define-grobs.scm       Sun Oct 16 01:25:47 2005
@@ -22,7 +22,8 @@
        (print-function . ,Accidental_interface::print)
        (avoid-slur . inside)
        (cautionary-style . parentheses)
-       (after-line-breaking-callback . 
,Accidental_interface::after_line_breaking)
+       (callbacks ((after-line-breaking . 
,Accidental_interface::after_line_breaking)))
+       
        (meta . ((class . Item)
                 (interfaces . (accidental-interface
                                font-interface))))))
@@ -94,7 +95,8 @@
        (X-offset-callbacks . (,Side_position_interface::aligned_side))
        (direction . -1)
        (cautionary-style . parentheses)
-       (after-line-breaking-callback . 
,Accidental_interface::after_line_breaking)
+       (callbacks . ((after-line-breaking . 
,Accidental_interface::after_line_breaking)
+                     ))
        (meta . ((class . Item)
                 (interfaces . (item-interface
                                accidental-interface
@@ -141,7 +143,7 @@
        (print-function . ,Bar_line::print)
        (break-visibility . ,all-visible)
        (breakable . #t)
-       (before-line-breaking-callback . ,Bar_line::before_line_breaking)
+       (callbacks . ((before-line-breaking . ,Bar_line::before_line_breaking)))
        (space-alist . (
                        (time-signature . (extra-space . 0.75))
                        (custos . (minimum-space . 2.0))
@@ -264,8 +266,6 @@
 
        ;; TODO: should be in SLT.
        (thickness . 0.48) ; in staff-space
-;      (before-line-breaking-callback . ,Beam::before_line_breaking)
-;      (after-line-breaking-callback . ,Beam::after_line_breaking)
        (neutral-direction . -1)
        (dir-function . ,beam-dir-majority-median)
 
@@ -377,7 +377,7 @@
     (Clef
      . (
        (print-function . ,Clef::print)
-       (before-line-breaking-callback . ,Clef::before_line_breaking)
+       (callbacks ((before-line-breaking . ,Clef::before_line_breaking)))
        (breakable . #t)
        (font-family . music)
        (break-align-symbol . clef)
@@ -417,7 +417,8 @@
     (ChordName
      . (
        (print-function . ,Text_interface::print)
-       (after-line-breaking-callback . ,Chord_name::after_line_breaking)
+       (callbacks . ((after-line-breaking . ,Chord_name::after_line_breaking)
+                     ))
        (word-space . 0.0)
        (font-family . sans)
        (font-size . 1.5)
@@ -541,7 +542,8 @@
     (DynamicText
      . (
        (print-function . ,Text_interface::print)
-       (before-line-breaking-callback . 
,Script_interface::before_line_breaking)
+       ;; todo.
+       (callbacks . ((before-line-breaking . 
,Script_interface::before_line_breaking)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (self-alignment-X . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
@@ -591,7 +593,7 @@
        (self-alignment-X . 0)
        (self-alignment-Y . 0)
        (script-priority . 100)
-       (before-line-breaking-callback . 
,Script_interface::before_line_breaking)
+       (callbacks . ((before-line-breaking . 
,Script_interface::before_line_breaking)))
        (font-encoding . fetaNumber)
        (font-size . -5)                ; don't overlap when next to heads.
        (meta . ((class . Item)
@@ -610,7 +612,8 @@
        (breakable . #t)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
-       (after-line-breaking-callback . ,Line_spanner::after_line_breaking)
+       (callbacks ((after-line-breaking . ,Line_spanner::after_line_breaking)
+                   ))
        (print-function . ,Line_spanner::print)
        (meta . ((class . Spanner)
                 (interfaces . (line-interface
@@ -638,7 +641,7 @@
     (Hairpin
      . (
        (print-function . ,Hairpin::print)
-       (after-line-breaking-callback . ,Hairpin::after_line_breaking)
+       (callbacks . ((after-line-breaking . ,Hairpin::after_line_breaking)))
        (thickness . 1.0)
        (height . 0.6666)
        (spacing-procedure . ,Spanner::set_spacing_rods)
@@ -1029,7 +1032,7 @@
     (PaperColumn
      . (
        (axes . (0))
-       (before-line-breaking-callback . ,Paper_column::before_line_breaking)
+       (callbacks ((before-line-breaking . 
,Paper_column::before_line_breaking)))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
 
        ;; debugging
@@ -1058,7 +1061,7 @@
      . (
        (axes . (0))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
-       (before-line-breaking-callback . ,Paper_column::before_line_breaking)
+       (callbacks . ((before-line-breaking . 
,Paper_column::before_line_breaking)))
        (breakable . #t)
 
        ;; debugging stuff: print column number.
@@ -1119,7 +1122,7 @@
        (print-function . ,Text_interface::print)
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
-       (after-line-breaking-callback . ,shift-right-at-line-begin)
+       (callbacks . ((after-line-breaking . ,shift-right-at-line-begin)))
        (self-alignment-X . 0)
        (direction . 1)
        (breakable . #t)
@@ -1154,12 +1157,14 @@
                 (interfaces . (percent-repeat-interface))))))
     (Rest
      . (
-       (after-line-breaking-callback . ,Rest::after_line_breaking)
        (X-extent-callback . ,Rest::extent_callback)
        (Y-extent-callback . ,Rest::extent_callback)
        (print-function . ,Rest::print)
-       (Y-offset-callbacks . (,Staff_symbol_referencer::callback
-                              ,Rest::polyphonic_offset_callback))
+       (Y-offset-callbacks . (
+                              ,Staff_symbol_referencer::callback
+                              ,Rest::polyphonic_offset_callback
+                              ,Rest::y_offset_callback
+                              ))
        (minimum-distance . 0.25)
        (meta . ((class . Item)
                 (interfaces . (font-interface
@@ -1187,7 +1192,7 @@
        (staff-padding . 0.25)
        ;; (script-priority . 0) priorities for scripts, see script.scm
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
-       (before-line-breaking-callback . 
,Script_interface::before_line_breaking)
+       (callbacks . ((before-line-breaking . 
,Script_interface::before_line_breaking)))
        (font-encoding . fetaMusic)
        (meta . ((class . Item)
                 (interfaces . (script-interface
@@ -1196,7 +1201,7 @@
 
     (ScriptColumn
      . (
-       (before-line-breaking-callback . ,Script_column::before_line_breaking)
+       (callbacks . ((before-line-breaking . 
,Script_column::before_line_breaking)))
        (meta . ((class . Item)
                 (interfaces . (script-column-interface))))))
 
@@ -1252,7 +1257,7 @@
        (Y-extent-callback . ())
        (layer . 0)
        (breakable . #t)
-       (before-line-breaking-callback . ,Span_bar::before_line_breaking)
+       (callbacks . ((before-line-breaking . ,Span_bar::before_line_breaking)))
        ;; ugh duplication!
 
        ;;
@@ -1473,7 +1478,8 @@
        (print-function . ,System_start_delimiter::print)
        (glyph . "bar-line")
        (thickness . 1.6)
-       (after-line-breaking-callback . 
,System_start_delimiter::after_line_breaking)
+       (callbacks . ((after-line-breaking . 
,System_start_delimiter::after_line_breaking)))
+       
        (meta . ((class . Spanner)
                 (interfaces . (system-start-delimiter-interface))))))
 
@@ -1502,7 +1508,7 @@
        ;; sync with Fingering ?
        (padding . 0.5)
        (staff-padding . 0.5)
-       (before-line-breaking-callback . 
,Script_interface::before_line_breaking)
+       (callbacks . ((before-line-breaking . 
,Script_interface::before_line_breaking)))
        (avoid-slur . around)
        (slur-padding . 0.5)
        (script-priority . 200)
@@ -1543,8 +1549,8 @@
     (TieColumn
      . (
        (callbacks . ((positioning-done . ,Tie_column::calc_positioning_done)
+                     (before-line-breaking . ,Tie_column::before_line_breaking)
                      ))
-       (before-line-breaking-callback . ,Tie_column::before_line_breaking)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
        
@@ -1722,7 +1728,7 @@
     (VoltaBracket
      . (
        (print-function . ,Volta_bracket_interface::print)
-       (after-line-breaking-callback . 
,Volta_bracket_interface::after_line_breaking)
+       (callbacks . ((after-line-breaking . 
,Volta_bracket_interface::after_line_breaking)))
        (direction . ,UP)
        (padding . 1)
        (font-encoding . fetaNumber)
@@ -1747,7 +1753,7 @@
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
        (print-function . ,Line_spanner::print)
-       (after-line-breaking-callback . ,Line_spanner::after_line_breaking)
+       (callbacks ((after-line-breaking . ,Line_spanner::after_line_breaking)))
        (meta . ((class . Spanner)
                 (interfaces . (line-spanner-interface
                                line-interface))))))))


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to