]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.124
authorfred <fred>
Wed, 27 Mar 2002 00:35:28 +0000 (00:35 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:35:28 +0000 (00:35 +0000)
CHANGES
lily/include/molecule.hh
lily/molecule.cc

diff --git a/CHANGES b/CHANGES
index 336570857ff07f30835be95678f08f3c1c3749ac..02d0d5f96643346c87bb84ba3b54c247a9c8b5eb 100644 (file)
--- 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
 
index 99ab0a1f32b7c97f79f9b5d1867a2c4deaab3f87..b135eeb45ba7a55ced90602900d71236293ef1fc 100644 (file)
@@ -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);
 };
 
 
index e135b6b3fc07efd113c30d3b27602001c5e161fd..c3cb95b66ac9211e8d29ea90809765a2bb97a895 100644 (file)
@@ -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
 {