]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam.cc (set_beaming): don't clip edges.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Oct 2005 10:43:36 +0000 (10:43 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Oct 2005 10:43:36 +0000 (10:43 +0000)
(connect_beams): don't clip edges.

* lily/beaming-info.cc (clip_edges): new function.

* lily/enclosing-bracket.cc (struct Enclosing_bracket): new file.

ChangeLog
lily/beam.cc
lily/beaming-info.cc
lily/enclosing-bracket.cc [new file with mode: 0644]
lily/include/beam.hh
lily/include/beaming.hh
scm/define-grobs.scm

index 581aa1d5b183e24a5fb7dddcc78d1e055fb0bc17..2ad2da6790c6575a644d276a7569d612c59db25c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-10-07  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/beam.cc (set_beaming): don't clip edges.
+       (connect_beams): don't clip edges.
+
+       * lily/beaming-info.cc (clip_edges): new function.
+
        * lily/enclosing-bracket.cc (struct Enclosing_bracket): new file.
 
        * Documentation/user/instrument-notation.itely (Figured bass):
index d0fc2800755353f2d19d337f0318c80205f81fc5..4c7d8b85efa441b4d2ff29cd05435f073bb72629 100644 (file)
@@ -217,7 +217,9 @@ Beam::connect_beams (Grob *me)
 
   Slice last_int;
   last_int.set_empty ();
-  SCM last_beaming = SCM_EOL;
+  
+  //  SCM last_beaming = SCM_EOL;
+  SCM last_beaming = scm_cons (SCM_EOL, scm_list_1 (scm_from_int (0)));
   Direction last_dir = CENTER;
   for (int i = 0; i < stems.size (); i++)
     {
@@ -229,15 +231,13 @@ Beam::connect_beams (Grob *me)
        {
          int start_point = position_with_maximal_common_beams
            (last_beaming, this_beaming,
-            last_dir, this_dir);
+            last_dir ? last_dir : this_dir,
+            this_dir);
 
          Direction d = LEFT;
          Slice new_slice;
          do
            {
-             if (d == RIGHT && i == stems.size () - 1)
-               continue;
-
              new_slice.set_empty ();
              SCM s = index_get_cell (this_beaming, d);
              for (; scm_is_pair (s); s = scm_cdr (s))
@@ -256,7 +256,6 @@ Beam::connect_beams (Grob *me)
        }
       else
        {
-         scm_set_car_x (this_beaming, SCM_EOL);
          SCM s = scm_cdr (this_beaming);
          for (; scm_is_pair (s); s = scm_cdr (s))
            {
@@ -265,10 +264,7 @@ Beam::connect_beams (Grob *me)
              last_int.add_point (np);
            }
        }
-
-      if (i == stems.size () -1)
-       scm_set_cdr_x (this_beaming, SCM_EOL);
-
+      
       if (scm_ilength (scm_cdr (this_beaming)) > 0)
        {
          last_beaming = this_beaming;
@@ -444,16 +440,22 @@ Beam::print (SCM grob)
          if (i > 0)
            rw = min (nw_f, ((xposn - last_xposn) / 2));
          else
-           rw = xposn - me->get_bound (LEFT)->extent (xcommon, X_AXIS)[RIGHT]
-             + break_overshoot[LEFT];
-
+           {
+             if (me->get_bound (LEFT)->break_status_dir ())
+               rw = xposn - me->get_bound (LEFT)->extent (xcommon, X_AXIS)[RIGHT]
+                 + break_overshoot[LEFT];
+             else
+               rw = 1.0;       // ugh.
+           }
+         
          if (stem)
            lw = min (nw_f, ((xposn - last_xposn) / 2));
          else
-           lw = me->get_bound (RIGHT)->relative_coordinate (xcommon, X_AXIS)
-             - last_xposn
-             + break_overshoot[RIGHT];
-
+           {
+             lw = me->get_bound (RIGHT)->relative_coordinate (xcommon, X_AXIS)
+               - last_xposn
+               + break_overshoot[RIGHT];
+           }
          rw += stem_width / 2;
          lw += last_stem_width / 2;
 
@@ -1160,7 +1162,7 @@ Beam::set_stem_lengths (Grob *me)
 }
 
 void
-Beam::set_beaming (Grob *me, Beaming_info_list *beaming)
+Beam::set_beaming (Grob *me, Beaming_info_list const *beaming)
 {
   extract_grob_set (me, "stems", stems);
 
@@ -1173,11 +1175,6 @@ Beam::set_beaming (Grob *me, Beaming_info_list *beaming)
 
       do
        {
-         /* Don't set beaming for outside of outer stems */
-         if ((d == LEFT && i == 0)
-             || (d == RIGHT && i == stems.size () -1))
-           continue;
-
          Grob *stem = stems[i];
          SCM beaming_prop = stem->get_property ("beaming");
          if (beaming_prop == SCM_EOL
index f71ce8cfb261b891b725cee6c16672fa174fdeee..63f845489b09b96866dc961f66a22edc19050c47 100644 (file)
@@ -91,6 +91,8 @@ Beaming_info_list::beamify (Moment &beat_length, bool subdivide)
 
   infos_ = splits[LEFT].infos_;
   infos_.concat (splits[RIGHT].infos_);
+
+  clip_edges ();
 }
 
 void
@@ -98,3 +100,13 @@ Beaming_info_list::add_stem (Moment m, int b)
 {
   infos_.push (Beaming_info (m, b));
 }
+
+void
+Beaming_info_list::clip_edges ()
+{
+  if (infos_.size ())
+    {
+      infos_[0].beams_i_drul_[LEFT] = 0;
+      infos_.top().beams_i_drul_[RIGHT] = 0;
+    }
+}
diff --git a/lily/enclosing-bracket.cc b/lily/enclosing-bracket.cc
new file mode 100644 (file)
index 0000000..90b9211
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+  enclosing-bracket.cc -- implement Enclosing_bracket
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "stencil.hh"
+#include "horizontal-bracket.hh"
+#include "grob.hh"
+#include "axis-group-interface.hh"
+#include "pointer-group-interface.hh"
+
+struct Enclosing_bracket
+{
+  static bool has_interface (Grob*);
+  
+public:
+  DECLARE_SCHEME_CALLBACK(print, (SCM));
+};
+
+
+ADD_INTERFACE(Enclosing_bracket,
+             "enclosing-bracket-interface",
+             "Brackets alongside bass figures.",
+             
+             /* props */
+             "bracket-flare "
+             "shorten-pair "
+             "edge-height "
+             "padding "
+             "thickness "
+             "elements "
+             );
+
+/* ugh: should make bracket interface. */
+
+
+MAKE_SCHEME_CALLBACK (Enclosing_bracket, print, 1);
+SCM
+Enclosing_bracket::print (SCM grob)
+{
+  Grob *me = unsmob_grob (grob);
+  extract_grob_set (me, "elements", elements);
+  if (elements.is_empty ())
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS); 
+  Interval xext = Axis_group_interface::relative_group_extent (elements, common_x, X_AXIS);
+
+
+  Stencil left_br = Horizontal_bracket::make_bracket (me, me, elements,
+                                                     Y_AXIS, LEFT);
+  Stencil right_br = Horizontal_bracket::make_bracket (me, me, elements,
+                                                      Y_AXIS, RIGHT);
+
+  xext.widen (robust_scm2double (me->get_property ("padding"), 0.25));
+  left_br.translate_axis (xext[LEFT], X_AXIS);
+  right_br.translate_axis (xext[RIGHT], X_AXIS);
+  
+  left_br.add_stencil (right_br);
+  left_br.translate_axis (-me->relative_coordinate (common_x, X_AXIS), X_AXIS);
+
+  return left_br.smobbed_copy ();
+}
+
index 120840cff41f5e98e051c8b4417b9638cf328cd8..3d9aa314bf45186ceb8d136792c03a95e37c814e 100644 (file)
@@ -48,7 +48,7 @@ public:
   static bool has_interface (Grob *);
   static void add_stem (Grob *, Grob *);
   static bool is_knee (Grob *);
-  static void set_beaming (Grob *, Beaming_info_list *);
+  static void set_beaming (Grob *, Beaming_info_list const *);
   static void set_stemlens (Grob *);
   static int get_beam_count (Grob *me);
   static void position_beam (Grob *me);
index 0200d55a68ef5353773b21fb1db841a100aa361e..b541691087e844fcd8a11167a351082bf4e38a4e 100644 (file)
@@ -34,6 +34,7 @@ struct Beaming_info_list
   int best_splitpoint_index (Moment &beat_length, bool subdivide) const;
   void beamify (Moment &beat_length, bool subdivide);
   void add_stem (Moment d, int beams);
+  void clip_edges ();
 };
 
 #endif /* BEAMING_HH */
index 23c3322f1a5f78129ca0ece4509ee81fba7f65a7..40ab72ddfa4a7b4991acb7177f9ba249588c444d 100644 (file)
      . ((print-function . ,Enclosing_bracket::print)
        (edge-height . (0.2 . 0.2))
        (meta . ((class . Item)
-                (interfaces . (figured-bass-bracket-interface)) ))
+                (interfaces . (enclosing-bracket-interface)) ))
        ))
     (BassFigureContinuation
      . (