Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "item.hh" | 47 #include "item.hh" |
48 #include "least-squares.hh" | 48 #include "least-squares.hh" |
49 #include "lookup.hh" | 49 #include "lookup.hh" |
50 #include "main.hh" | 50 #include "main.hh" |
51 #include "misc.hh" | 51 #include "misc.hh" |
52 #include "note-head.hh" | 52 #include "note-head.hh" |
53 #include "output-def.hh" | 53 #include "output-def.hh" |
54 #include "pointer-group-interface.hh" | 54 #include "pointer-group-interface.hh" |
55 #include "rhythmic-head.hh" | 55 #include "rhythmic-head.hh" |
56 #include "spanner.hh" | 56 #include "spanner.hh" |
57 #include "staff-symbol.hh" | |
57 #include "staff-symbol-referencer.hh" | 58 #include "staff-symbol-referencer.hh" |
58 #include "stem.hh" | 59 #include "stem.hh" |
59 #include "warn.hh" | 60 #include "warn.hh" |
60 | 61 |
61 #if DEBUG_BEAM_SCORING | 62 #if DEBUG_BEAM_SCORING |
62 #include "text-interface.hh" // debug output. | 63 #include "text-interface.hh" // debug output. |
63 #include "font-interface.hh" // debug output. | 64 #include "font-interface.hh" // debug output. |
64 #endif | 65 #endif |
65 | 66 |
66 #include <map> | 67 #include <map> |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1724 /* Inside staff, move by whole spaces*/ | 1725 /* Inside staff, move by whole spaces*/ |
1725 if ((rest_extent[d] + staff_space * shift) * d | 1726 if ((rest_extent[d] + staff_space * shift) * d |
1726 < rad | 1727 < rad |
1727 || (rest_extent[-d] + staff_space * shift) * -d | 1728 || (rest_extent[-d] + staff_space * shift) * -d |
1728 < rad) | 1729 < rad) |
1729 shift = ceil (fabs (shift)) * sign (shift); | 1730 shift = ceil (fabs (shift)) * sign (shift); |
1730 | 1731 |
1731 return scm_from_double (offset + staff_space * shift); | 1732 return scm_from_double (offset + staff_space * shift); |
1732 } | 1733 } |
1733 | 1734 |
1735 /* | |
1736 Below, the prev_offset parameter is intentionally unused. This is | |
1737 because the old offset is assummedly irrelevant once the rest | |
1738 collision callback is employed (see rest-collision-engraver.cc). | |
1739 */ | |
1740 | |
1741 MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, pure_rest_collision_callback, 4, 1, "") ; | |
1742 SCM | |
1743 Beam::pure_rest_collision_callback (SCM smob, SCM prev_offset, | |
Keith
2012/04/27 06:06:21
Mike, Based on their contents, the arguments appea
mike7
2012/04/27 06:44:24
You're right - this is an error. Do you want me t
| |
1744 SCM /* start */, | |
1745 SCM /* end */) | |
1746 { | |
1747 Real amount = 0.0; | |
1748 | |
1749 Grob *me = unsmob_grob (smob); | |
1750 Grob *stem = unsmob_grob (me->get_object ("stem")); | |
1751 if (!stem) | |
1752 return scm_from_double (amount); | |
1753 Grob *beam = unsmob_grob (stem->get_object ("beam")); | |
1754 if (!beam | |
1755 || !Beam::normal_stem_count (beam)) | |
1756 return scm_from_double (amount); | |
1757 | |
1758 Real ss = Staff_symbol_referencer::staff_space (me); | |
1759 | |
1760 /* | |
1761 This gives the extrema of rest positions. | |
1762 In general, beams are never typeset more than one staff space away | |
1763 from the staff in either direction. | |
1764 */ | |
1765 Interval rest_max_pos = Staff_symbol::line_span (Staff_symbol_referencer::get_ staff_symbol (me)); | |
1766 rest_max_pos.widen (1); | |
1767 rest_max_pos *= ss / 2; | |
1768 | |
1769 extract_grob_set (beam, "stems", stems); | |
1770 vector<Grob *> my_stems; | |
1771 | |
1772 for (vsize i = 0; i < stems.size (); i++) | |
1773 if (Stem::head_count (stems[i]) || stems[i] == stem) | |
1774 my_stems.push_back (stems[i]); | |
1775 | |
1776 vsize idx = -1; | |
1777 | |
1778 for (vsize i = 0; i < my_stems.size (); i++) | |
1779 if (my_stems[i] == stem) | |
1780 { | |
1781 idx = i; | |
1782 break; | |
1783 } | |
1784 Grob *left; | |
1785 Grob *right; | |
1786 | |
1787 if (idx == -1 || my_stems.size () == 1) | |
1788 return scm_from_double (amount); | |
1789 else if (idx == 0) | |
1790 left = right = my_stems[1]; | |
1791 else if (idx == my_stems.size () - 1) | |
1792 left = right = my_stems[idx - 1]; | |
1793 else | |
1794 { | |
1795 left = my_stems[idx - 1]; | |
1796 right = my_stems[idx + 1]; | |
1797 } | |
1798 Direction beamdir = get_grob_direction (beam); | |
1799 /* | |
1800 Take the position between the two bounding head_positions, | |
1801 then bound it by the minimum and maximum positions outside the staff. | |
1802 4.0 = 2.0 to get out of staff space * 2.0 for the average | |
1803 */ | |
1804 amount = min (max ((Stem::head_positions (left)[beamdir] + Stem::head_position s (right)[beamdir]) / 4.0, rest_max_pos[DOWN]), rest_max_pos[UP]); | |
1805 | |
1806 return scm_from_double (amount); | |
1807 } | |
1808 | |
1809 | |
1734 bool | 1810 bool |
1735 Beam::is_knee (Grob *me) | 1811 Beam::is_knee (Grob *me) |
1736 { | 1812 { |
1737 SCM k = me->get_property ("knee"); | 1813 SCM k = me->get_property ("knee"); |
1738 if (scm_is_bool (k)) | 1814 if (scm_is_bool (k)) |
1739 return ly_scm2bool (k); | 1815 return ly_scm2bool (k); |
1740 | 1816 |
1741 bool knee = false; | 1817 bool knee = false; |
1742 int d = 0; | 1818 int d = 0; |
1743 extract_grob_set (me, "stems", stems); | 1819 extract_grob_set (me, "stems", stems); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 "knee " | 1933 "knee " |
1858 "length-fraction " | 1934 "length-fraction " |
1859 "least-squares-dy " | 1935 "least-squares-dy " |
1860 "neutral-direction " | 1936 "neutral-direction " |
1861 "normal-stems " | 1937 "normal-stems " |
1862 "positions " | 1938 "positions " |
1863 "quantized-positions " | 1939 "quantized-positions " |
1864 "shorten " | 1940 "shorten " |
1865 "stems " | 1941 "stems " |
1866 ); | 1942 ); |
OLD | NEW |