(connect_beams): don't clip edges.
* lily/beaming-info.cc (clip_edges): new function.
* lily/enclosing-bracket.cc (struct Enclosing_bracket): new file.
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):
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++)
{
{
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))
}
else
{
- scm_set_car_x (this_beaming, SCM_EOL);
SCM s = scm_cdr (this_beaming);
for (; scm_is_pair (s); s = scm_cdr (s))
{
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;
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;
}
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);
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
infos_ = splits[LEFT].infos_;
infos_.concat (splits[RIGHT].infos_);
+
+ clip_edges ();
}
void
{
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;
+ }
+}
--- /dev/null
+/*
+ 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 ();
+}
+
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);
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 */
. ((print-function . ,Enclosing_bracket::print)
(edge-height . (0.2 . 0.2))
(meta . ((class . Item)
- (interfaces . (figured-bass-bracket-interface)) ))
+ (interfaces . (enclosing-bracket-interface)) ))
))
(BassFigureContinuation
. (