Re: Dynamics do not unnecessarily horizontal shift for stems. (issue 6493073)

2012-09-03 Thread graham

adds programming errors.  I've set it to patch-needs_work.

http://codereview.appspot.com/6493073/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Dynamics do not unnecessarily horizontal shift for stems. (issue 6493073)

2012-09-03 Thread graham


http://codereview.appspot.com/6493073/diff/3001/lily/self-alignment-interface.cc
File lily/self-alignment-interface.cc (right):

http://codereview.appspot.com/6493073/diff/3001/lily/self-alignment-interface.cc#newcode205
lily/self-alignment-interface.cc:205: // if coll is cross staff but
extremal and poiting in the
typo: pointing

http://codereview.appspot.com/6493073/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Dynamics do not unnecessarily horizontal shift for stems. (issue 6493073)

2012-09-02 Thread dak


http://codereview.appspot.com/6493073/diff/1/lily/self-alignment-interface.cc
File lily/self-alignment-interface.cc (right):

http://codereview.appspot.com/6493073/diff/1/lily/self-alignment-interface.cc#newcode213
lily/self-alignment-interface.cc:213: vector_sort (vais, lessint ());
Seriously?  If dir is UP, you are interested in the minimum, and if it
is DOWN, you are interested in the maximum.  And you create a vector and
sort it for that?

Totally inefficient as well as incomprehensible.

http://codereview.appspot.com/6493073/diff/1/lily/self-alignment-interface.cc#newcode280
lily/self-alignment-interface.cc:280: potential-X-colliding-grobs 
Does normal-stems need to be here?

http://codereview.appspot.com/6493073/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Dynamics do not unnecessarily horizontal shift for stems. (issue 6493073)

2012-09-02 Thread mtsolo

Reviewers: dak,

Message:
Thanks for the review!


http://codereview.appspot.com/6493073/diff/1/lily/self-alignment-interface.cc
File lily/self-alignment-interface.cc (right):

http://codereview.appspot.com/6493073/diff/1/lily/self-alignment-interface.cc#newcode213
lily/self-alignment-interface.cc:213: vector_sort (vais, lessint ());
On 2012/09/02 16:06:30, dak wrote:

Seriously?  If dir is UP, you are interested in the minimum, and if it

is DOWN,

you are interested in the maximum.  And you create a vector and sort

it for

that?



Totally inefficient as well as incomprehensible.


Good catch - changed to Interval_tint

Description:
Dynamics do not unnecessarily horizontal shift for stems.

Please review this at http://codereview.appspot.com/6493073/

Affected files:
  A input/regression/dynamics-avoid-cross-staff-stem-2.ly
  M lily/self-alignment-interface.cc


Index: input/regression/dynamics-avoid-cross-staff-stem-2.ly
diff --git a/input/regression/dynamics-avoid-cross-staff-stem-2.ly  
b/input/regression/dynamics-avoid-cross-staff-stem-2.ly

new file mode 100644
index  
..e549646f75df457d18513c7b0bc5f9f24adcad1b

--- /dev/null
+++ b/input/regression/dynamics-avoid-cross-staff-stem-2.ly
@@ -0,0 +1,23 @@
+\version 2.17.2
+
+\header {
+  texidoc = Dynamics do not horizontally shift when attached to
+an axis-group extremal cross staff grob that's extremal side
+(UP or DOWN) is the same as its direction.
+
+}
+
+\new PianoStaff 
+  \new Staff = up {
+s1 |
+  }
+  \new Staff = down {
+\clef bass
+\stemDown
+% keep staff alive
+c,, c,8 [ c,, c,8_\f
+\change Staff = up
+g' g' ]
+r2 |
+  }
+
Index: lily/self-alignment-interface.cc
diff --git a/lily/self-alignment-interface.cc  
b/lily/self-alignment-interface.cc
index  
a37b5871007eec8ef9368976958997b6a4c84a98..2a033340ff27c283350c43cb3fc7ffba7cedf2d6  
100644

--- a/lily/self-alignment-interface.cc
+++ b/lily/self-alignment-interface.cc
@@ -199,7 +199,24 @@ Self_alignment_interface::avoid_colliding_grobs (Grob  
*me, Axis a, Real offset)


   Interval iv = me-extent (me, a) + offset;
   for (vsize i = 0; i  colls.size (); i++)
-ivs.push_back (colls[i]-extent (refp, a));
+{
+  int my_vai = Grob::get_vertical_axis_group_index (colls[i]);
+  Direction dir = get_grob_direction (colls[i]);
+  // if coll is cross staff but extremal and poiting in the
+  // direction of the extrema, we don't take it into consideration
+  if (Grob *beam = unsmob_grob (colls[i]-get_object (beam)))
+{
+  Interval_tint vais;
+  extract_grob_set (beam, normal-stems, stems);
+  for (vsize j = 0; j  stems.size (); j++)
+vais.add_point (Grob::get_vertical_axis_group_index  
(stems[j]));

+  // ugh...up and down are different for VerticalAxisGroup order...
+  if ((my_vai == vais[DOWN]  dir == UP)
+  || (my_vai == vais[UP]  dir == DOWN))
+continue;
+}
+  ivs.push_back (colls[i]-extent (refp, a));
+}

   Interval_minefield minefield (Interval (iv.center (), iv.center ()),  
iv.length ());

   for (vsize i = 0; i  ivs.size (); i++)



___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel