CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/04/18 12:06:36
Modified files:
. : ChangeLog THANKS
lily : line-interface.cc line-spanner.cc
paper-score.cc text-spanner.cc
lily/include : line-interface.hh paper-score.hh
scm : define-grob-properties.scm
Log message:
* lily/paper-score.cc (process): run get_paper_systems() only once.
* lily/line-interface.cc (make_arrow): new function. Patch by
Jonatan Liljedahl <http://kymatica.com>
(arrows): idem.
* lily/line-spanner.cc (line_stencil): add arrows.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3453&tr2=1.3454&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/THANKS.diff?tr1=1.107&tr2=1.108&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/line-interface.cc.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/line-spanner.cc.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/paper-score.cc.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/text-spanner.cc.diff?tr1=1.111&tr2=1.112&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/line-interface.hh.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/paper-score.hh.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grob-properties.scm.diff?tr1=1.99&tr2=1.100&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3453 lilypond/ChangeLog:1.3454
--- lilypond/ChangeLog:1.3453 Mon Apr 18 11:27:22 2005
+++ lilypond/ChangeLog Mon Apr 18 12:06:34 2005
@@ -1,3 +1,14 @@
+2005-04-18 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+
+ * lily/paper-score.cc (process): run get_paper_systems() only once.
+
+ * lily/line-interface.cc (make_arrow): new function. Patch by
+ Jonatan Liljedahl <http://kymatica.com>
+ (arrows): idem.
+
+ * lily/line-spanner.cc (line_stencil): add arrows.
+
+
2005-04-18 Mathieu Giraud <[EMAIL PROTECTED]>
* input/test/chord-names-german.ly: update for italian/french chords
Index: lilypond/THANKS
diff -u lilypond/THANKS:1.107 lilypond/THANKS:1.108
--- lilypond/THANKS:1.107 Sun Apr 17 21:09:45 2005
+++ lilypond/THANKS Mon Apr 18 12:06:35 2005
@@ -21,6 +21,7 @@
Heikki Junes
Jeff Smith
John Williams
+Jonatan Liljedahl
Juergen Reuter
Juliusz Chroboczek
Matthias Neeracher
Index: lilypond/lily/include/line-interface.hh
diff -u lilypond/lily/include/line-interface.hh:1.5
lilypond/lily/include/line-interface.hh:1.6
--- lilypond/lily/include/line-interface.hh:1.5 Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/line-interface.hh Mon Apr 18 12:06:36 2005
@@ -17,6 +17,12 @@
static bool has_interface (Grob *);
static Stencil make_dashed_line (Real th, Offset from, Offset to, Real,
Real);
static Stencil make_line (Real th, Offset from, Offset to);
+ static Stencil make_arrow (Offset beg, Offset end, Real thick,
+ Real length, Real width);
+ static Stencil arrows (Grob *me, Offset from, Offset to,
+ bool from_arrow,
+ bool to_arrow);
+
};
#endif /* LINE_INTERFACE_HH */
Index: lilypond/lily/include/paper-score.hh
diff -u lilypond/lily/include/paper-score.hh:1.30
lilypond/lily/include/paper-score.hh:1.31
--- lilypond/lily/include/paper-score.hh:1.30 Mon Apr 18 00:36:45 2005
+++ lilypond/lily/include/paper-score.hh Mon Apr 18 12:06:36 2005
@@ -18,6 +18,7 @@
Output_def *layout_;
System *system_;
SCM systems_;
+ SCM paper_systems_;
public:
Paper_score (Output_def *);
Index: lilypond/lily/line-interface.cc
diff -u lilypond/lily/line-interface.cc:1.19
lilypond/lily/line-interface.cc:1.20
--- lilypond/lily/line-interface.cc:1.19 Thu Mar 10 14:36:13 2005
+++ lilypond/lily/line-interface.cc Mon Apr 18 12:06:36 2005
@@ -13,6 +13,30 @@
#include "output-def.hh"
Stencil
+Line_interface::make_arrow (Offset beg, Offset end,
+ Real thick,
+ Real length, Real width)
+{
+ Real angle = (end - beg).arg();
+ Array<Offset> points;
+
+ //construct the arrow
+ points.push (Offset (0, 0));
+ points.push (Offset (length, width));
+ points.push (Offset (length, -width));
+
+ // rotate and translate the arrow
+ for (int i = 0; i < points.size(); i++)
+ points[i] = points[i] * complex_exp (Offset (0, angle)) + beg;
+
+ // we must shorten the line half of arrow length
+ // to prevent the line from sticking out
+ beg = beg + Offset (length/2,0) * complex_exp (Offset (0, angle));
+
+ return (Lookup::round_filled_polygon (points, thick));
+}
+
+Stencil
Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
Real dash_period, Real dash_fraction)
{
@@ -62,6 +86,30 @@
}
Stencil
+Line_interface::arrows (Grob *me, Offset from, Offset to,
+ bool from_arrow,
+ bool to_arrow)
+{
+ Stencil a;
+ if (from_arrow || to_arrow)
+ {
+ Real thick = Staff_symbol_referencer::line_thickness (me)
+ * robust_scm2double (me->get_property ("thickness"), 1);
+ Real len = robust_scm2double (me->get_property ("arrow-length"), 1.3);
+ Real wid = robust_scm2double (me->get_property ("arrow-width"), 0.5);
+
+ if (to_arrow)
+ a.add_stencil (make_arrow (from, to, thick, len, wid));
+
+ if (from_arrow)
+ a.add_stencil (make_arrow (to, from, thick, len, wid));
+ }
+
+ return a;
+}
+
+
+Stencil
Line_interface::line (Grob *me, Offset from, Offset to)
{
Real thick = Staff_symbol_referencer::line_thickness (me)
@@ -69,6 +117,8 @@
SCM type = me->get_property ("style");
+ Stencil l;
+
SCM dash_fraction = me->get_property ("dash-fraction");
if (scm_is_number (dash_fraction) || type == ly_symbol2scm ("dotted-line"))
{
@@ -85,12 +135,14 @@
if (period < 0)
return Stencil ();
- return make_dashed_line (thick, from, to, period, fraction);
+ l = make_dashed_line (thick, from, to, period, fraction);
}
else
{
- return make_line (thick, from, to);
+ l = make_line (thick, from, to);
}
+
+ return l;
}
ADD_INTERFACE (Line_interface, "line-interface",
@@ -101,4 +153,4 @@
"produced. If @code{dash-fraction} is negative, the line is made
"
"transparent.",
- "dash-period dash-fraction thickness style")
+ "dash-period dash-fraction thickness style arrow-length
arrow-width")
Index: lilypond/lily/line-spanner.cc
diff -u lilypond/lily/line-spanner.cc:1.59 lilypond/lily/line-spanner.cc:1.60
--- lilypond/lily/line-spanner.cc:1.59 Wed Mar 16 19:19:15 2005
+++ lilypond/lily/line-spanner.cc Mon Apr 18 12:06:36 2005
@@ -95,6 +95,9 @@
{
Offset dz = to -from;
SCM type = me->get_property ("style");
+
+ Stencil line;
+
if (scm_is_symbol (type)
&& (type == ly_symbol2scm ("line")
|| type == ly_symbol2scm ("dashed-line")
@@ -102,7 +105,7 @@
|| type == ly_symbol2scm ("zigzag")
|| (type == ly_symbol2scm ("trill") && dz[Y_AXIS] != 0)))
{
- return (type == ly_symbol2scm ("zigzag"))
+ line = (type == ly_symbol2scm ("zigzag"))
? zigzag_stencil (me, from, to)
: Line_interface::line (me, from, to);
}
@@ -135,8 +138,12 @@
+ mol.extent (Y_AXIS).length ()) / 2, Y_AXIS);
mol.translate (from);
- return mol;
+ line = mol;
}
+
+ if (to_boolean (me->get_property ("arrow")))
+ line.add_stencil (Line_interface::arrows (me, from, to, false, true));
+
return Stencil ();
}
@@ -288,5 +295,5 @@
"@code{dashed-line}, @code{trill}, \n"
"@code{dotted-line} or @code{zigzag}.\n"
"\n",
- "gap zigzag-width zigzag-length thickness");
+ "gap zigzag-width zigzag-length thickness arrow");
Index: lilypond/lily/paper-score.cc
diff -u lilypond/lily/paper-score.cc:1.81 lilypond/lily/paper-score.cc:1.82
--- lilypond/lily/paper-score.cc:1.81 Mon Apr 18 00:36:45 2005
+++ lilypond/lily/paper-score.cc Mon Apr 18 12:06:36 2005
@@ -26,6 +26,7 @@
layout_ = layout;
system_ = 0;
systems_ = SCM_EOL;
+ paper_systems_ = SCM_EOL;
}
Paper_score::Paper_score (Paper_score const &s)
@@ -39,6 +40,7 @@
Paper_score::derived_mark () const
{
scm_gc_mark (systems_);
+ scm_gc_mark (paper_systems_);
}
void
@@ -89,7 +91,8 @@
Array<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
- system_->get_paper_systems ();
+
+ paper_systems_ = system_->get_paper_systems ();
}
System *
@@ -108,5 +111,5 @@
SCM
Paper_score::get_systems () const
{
- return root_system ()->get_paper_systems ();
+ return paper_systems_;
}
Index: lilypond/lily/text-spanner.cc
diff -u lilypond/lily/text-spanner.cc:1.111 lilypond/lily/text-spanner.cc:1.112
--- lilypond/lily/text-spanner.cc:1.111 Wed Mar 16 19:19:15 2005
+++ lilypond/lily/text-spanner.cc Mon Apr 18 12:06:36 2005
@@ -148,7 +148,8 @@
if (!span_points.is_empty ())
{
- Stencil l = Line_spanner::line_stencil (me, Offset (span_points[LEFT],
0),
+ Stencil l = Line_spanner::line_stencil (me,
+ Offset (span_points[LEFT], 0),
Offset (span_points[RIGHT], 0));
m.add_stencil (l);
}
Index: lilypond/scm/define-grob-properties.scm
diff -u lilypond/scm/define-grob-properties.scm:1.99
lilypond/scm/define-grob-properties.scm:1.100
--- lilypond/scm/define-grob-properties.scm:1.99 Tue Apr 12 22:49:25 2005
+++ lilypond/scm/define-grob-properties.scm Mon Apr 18 12:06:36 2005
@@ -147,6 +147,10 @@
dash-period. Should be between 0.0 (no line) and 1.0 (continuous
line).")
+ (arrow ,boolean? "Add an arrow to the line.")
+ (arrow-length ,number? "Arrow length.")
+ (arrow-width ,number? "Arrow width.")
+
;; todo: why is this tunable?
(dir-function ,procedure? "The function to determine the
direction of a beam. Choices include:
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs