From: fred Date: Wed, 27 Mar 2002 00:35:28 +0000 (+0000) Subject: lilypond-1.3.124 X-Git-Tag: release/1.5.59~996 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=083c1425dfeee35d5331f221bfc03b6a11a09220;p=lilypond.git lilypond-1.3.124 --- diff --git a/CHANGES b/CHANGES index 336570857f..02d0d5f966 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,27 @@ -1.3.122.mb2 +1.3.123.hwn1 +============ + +* Tutorial fragment on ly2dvi. + +* Bugfix: also print path of mismatched .TFM file. + +* Some callbacks to allow manipulation of fonts and molecules from +Scheme. See input/test/molecule-hacking.ly ; allows for a kludged +"parenthesize notehead" command. + + +1.3.123.mb1 =========== +* Added percussion clef. Note: font updated! + +* Bugfix: font style Large works regardless of font-shape. + + + +1.3.123 +======= + * Added macro \turnOff to remove volta brackets or any other graphical objects, see input/test/volta.ly or mutopia/J.S.Bach/pa.ly diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 99ab0a1f32..b135eeb45b 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -78,6 +78,11 @@ public: */ SCM create_scheme () const; bool empty_b() const; + + + static SCM ly_get_molecule_extent (SCM mol, SCM axis); + static SCM ly_set_molecule_extent_x (SCM,SCM,SCM); + static SCM ly_molecule_combined_at_edge (SCM,SCM,SCM,SCM,SCM); }; diff --git a/lily/molecule.cc b/lily/molecule.cc index e135b6b3fc..c3cb95b66a 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -132,6 +132,85 @@ Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding) add_molecule (toadd); } + + + +bool +number_pair_p (SCM p) +{ + return gh_pair_p (p) && gh_number_p (gh_car (p)) && gh_number_p (gh_cdr (p)); +} + +bool +axis_p (SCM a) +{ + return gh_number_p (a) && (gh_scm2int (a) == 0 || gh_scm2int (a) == 1); +} + +SCM +Molecule::ly_set_molecule_extent_x (SCM mol, SCM axis, SCM np) +{ + Molecule* m = unsmob_molecule (mol); + if (m && axis_p (axis) && number_pair_p (np)) + { + Interval iv = ly_scm2interval (np); + m->dim_[Axis(gh_scm2int (axis))] = ly_scm2interval (np); + } + else + warning ("ly-set-molecule-extent!: invalid arguments"); + return SCM_UNDEFINED; +} + +SCM +Molecule::ly_get_molecule_extent (SCM mol, SCM axis) +{ + Molecule *m = unsmob_molecule (mol); + + if (!m || !axis_p (axis)) + { + warning ("ly-get-molecule-extent: invalid arguments"); + return ly_interval2scm (Interval (0,0)); + } + + return ly_interval2scm (m->extent (Axis (gh_scm2int (axis)))); +} + + +SCM +Molecule::ly_molecule_combined_at_edge (SCM first, SCM axis, SCM direction, + SCM second, SCM padding) + +{ + Molecule * m1 = unsmob_molecule (first); + Molecule * m2 = unsmob_molecule (second); + Molecule result; + + if (!m1 || !m2 || !isdir_b (direction) || !axis_p (axis) || !gh_number_p (padding)) + { + warning ("ly-combine-molecule-at-edge: invalid arguments"); + Molecule r; + return r.smobbed_copy (); + } + + result = *m1; + + result.add_at_edge (Axis (gh_scm2int (axis)), Direction (gh_scm2int (direction)), + *m2, gh_scm2double (padding)); + + return result.smobbed_copy (); +} + + +static void +molecule_init () +{ + scm_make_gsubr ("ly-combine-molecule-at-edge", 5 , 0, 0, (Scheme_function_unknown) Molecule::ly_molecule_combined_at_edge); + scm_make_gsubr ("ly-set-molecule-extent!", 3 , 0, 0, (Scheme_function_unknown) Molecule::ly_set_molecule_extent_x); + scm_make_gsubr ("ly-get-molecule-extent", 2 , 0, 0, (Scheme_function_unknown) Molecule::ly_get_molecule_extent); +} +ADD_SCM_INIT_FUNC(molecule,molecule_init); + + bool Molecule::empty_b () const {