lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the height of a system.


From: Han-Wen Nienhuys
Subject: Re: Getting the height of a system.
Date: Wed, 07 Jun 2006 10:25:33 +0200
User-agent: Thunderbird 1.5.0.2 (X11/20060501)

Joe Neeman schreef:
Did my previous mail make it to the list? I never saw it... but anyway,
here's an update

sorry, it was on my todo list, but your patch got caught up in other stuff.

make web still works and there are no detected formatting changes.

Very very cool. Does this complete the optimal pagebreaking, or does the dynamic programming part need more work now?

+
+  if (scm_is_number (dy_scm))
+    {
+      Real dy = scm_to_double (dy_scm) * robust_scm2dir (me->get_property 
("stacking-dir"), DOWN);
+      Real pos = 0;
+      for (vsize i = 0; i < all_grobs.size (); i++)
+       {
+         if (all_grobs[i] == ch)
+           return pos;
+         if (!Hara_kiri_group_spanner::has_interface (all_grobs[i])
+             || !Hara_kiri_group_spanner::request_suicide (all_grobs[i], 
start, end))
+           pos += dy;
+       }
     }
+  else

don't understand: aren't you missing a return? pos isn't used any further.


+  vsize start_brk = VPOS;
+  vsize end_brk = VPOS;

brk -> index

+
+  /* The only time a parent is allowed to affect its children's Y-offset is if
+     it has align-interface */
+  Grob *p = get_parent (Y_AXIS);

I think you know, but this happens in some other cases as well. Mostly all grobs that support the positioning-done property.


+  if (pure && a != Y_AXIS)
+    programming_error (_f ("tried to get pure X-offset"));

don't mark programming errors as translatable. They're supposed to be read by programmers, not users.

+bool
+Hara_kiri_group_spanner::request_suicide (Grob *me, int start, int end)
+{
+  if (!to_boolean (me->get_property ("remove-empty")))
+    return false;

+  SCM important = me->get_property ("important-columns");

Clever!

+      for (vsize i = 0; i < worth.size (); i++)
+       {
+         Item *it = dynamic_cast<Item*> (worth[i]);
+         if (it)
+           {
+             vsize col = Paper_column::get_rank (it->get_column ());
+             important_cols.resize (max (important_cols.size (), col+1));
+             important_cols[col] = 1;
+           }
+       }

This looks dodgy. The resize call may introduce uninitialized data. Isn't it easier to sort the items-worth-living by column-rank and then insert False for any spans that are skipped by items-worth-living?

Considering naming, I'd use important-column-ranks.

Please use "true" iso. "1".

+
+      /* if we end up suiciding, our Y-axis-parent won't get the correct
+        Y-extent unless we add our child to it */
+      Grob *p = unsmob_grob (get_object ("axis-group-parent-Y"));
+      if (p)
+       Axis_group_interface::add_element (p, dolly);

This will result in duplicate elements in the axis-group-parent-Y after line breaking. Isn't it possible to handle this in any of the relevant pure_XX functions?

--

Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]