summaryrefslogtreecommitdiff
path: root/lily/include
diff options
context:
space:
mode:
authorMike Solomon <mike@apollinemike.com>2013-01-10 08:54:12 +0100
committerMike Solomon <mike@apollinemike.com>2013-01-10 08:54:12 +0100
commit7d3d28de0ce6e2f018aff599cecd944d1754fe3c (patch)
treecec19da8e57abacdb636ff7bddec8b68753ab8ba /lily/include
parent2502db9d63fd5c0ac2171e3c70943510d4456746 (diff)
Makes all side-positioning based on skylines instead of boxes.
The major work is in side-position-interface.cc, with minor modifications at several places in the code-base to adapt to this. This allows for snugger positioning of horizontally-oriented fingerings. A side-effect of this patch is that side-positioning of all cross-staff grobs delves into the element list of axis-groups in order to better guess position, which results in less collisions (for example, dynamics are less likely to collide with cross-staff beams).
Diffstat (limited to 'lily/include')
-rw-r--r--lily/include/axis-group-interface.hh3
-rw-r--r--lily/include/box-quarantine.hh41
-rw-r--r--lily/include/box.hh2
-rw-r--r--lily/include/grob.hh8
-rw-r--r--lily/include/multi-measure-rest.hh1
-rw-r--r--lily/include/self-alignment-interface.hh4
-rw-r--r--lily/include/side-position-interface.hh5
-rw-r--r--lily/include/skyline.hh1
8 files changed, 53 insertions, 12 deletions
diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh
index 4098a19514..1ba26af829 100644
--- a/lily/include/axis-group-interface.hh
+++ b/lily/include/axis-group-interface.hh
@@ -34,6 +34,7 @@ class Axis_group_interface
static Real get_default_outside_staff_padding ();
static Interval generic_bound_extent (Grob *me, Grob *common, Axis a);
static Interval pure_group_height (Grob *me, int start, int end);
+ DECLARE_SCHEME_CALLBACK (cross_staff, (SCM smob));
DECLARE_SCHEME_CALLBACK (width, (SCM smob));
DECLARE_SCHEME_CALLBACK (calc_x_common, (SCM smob));
DECLARE_SCHEME_CALLBACK (calc_y_common, (SCM smob));
@@ -62,7 +63,7 @@ class Axis_group_interface
static Interval part_of_line_pure_height (Grob *me, bool begin, int, int);
static Grob *outside_staff_ancestor (Grob *me);
- static Skyline_pair skyline_spacing (Grob *me, vector<Grob *> elements);
+ static Skyline_pair skyline_spacing (Grob *me);
static void add_element (Grob *me, Grob *);
static void set_axes (Grob *, Axis, Axis);
static bool has_axis (Grob *, Axis);
diff --git a/lily/include/box-quarantine.hh b/lily/include/box-quarantine.hh
new file mode 100644
index 0000000000..3673a959bd
--- /dev/null
+++ b/lily/include/box-quarantine.hh
@@ -0,0 +1,41 @@
+/*
+ This file is part of LilyPond, the GNU music typesetter.
+
+ Copyright (C) 2012 Mike Solomon <mike@mikesolomon.org>
+
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BOX_QUARANTINE_HH
+#define BOX_QUARANTINE_HH
+
+#include "lily-proto.hh"
+#include "std-vector.hh"
+#include "box.hh"
+
+class Box_quarantine
+{
+public:
+ Box_quarantine (Real, Axis);
+ void add_box_to_quarantine (Box);
+ void solve ();
+ vector<Box> quarantined_boxes ();
+
+private:
+ vector<Box> boxes_to_quarantine_;
+ Real padding_;
+ Axis a_;
+};
+
+#endif // BOX_QUARANTINE_HH
diff --git a/lily/include/box.hh b/lily/include/box.hh
index ab0d3f5300..63224f2f88 100644
--- a/lily/include/box.hh
+++ b/lily/include/box.hh
@@ -21,6 +21,7 @@ public:
Interval operator [] (Axis a) const;
Interval &operator [] (Axis a);
Real area () const;
+ bool is_empty () const;
Offset center () const;
@@ -32,6 +33,7 @@ public:
void widen (Real x, Real y);
void scale (Real r);
void unite (Box b);
+ void intersect (Box b);
void print ();
Box ();
Box (Interval ix, Interval iy);
diff --git a/lily/include/grob.hh b/lily/include/grob.hh
index 09cd566ad3..a98b19a9f6 100644
--- a/lily/include/grob.hh
+++ b/lily/include/grob.hh
@@ -71,10 +71,12 @@ public:
DECLARE_SCHEME_CALLBACK (y_parent_positioning, (SCM));
DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob));
DECLARE_SCHEME_CALLBACK (stencil_width, (SCM smob));
- DECLARE_SCHEME_CALLBACK (simple_vertical_skylines_from_stencil, (SCM smob));
+ DECLARE_SCHEME_CALLBACK (pure_simple_vertical_skylines_from_extents, (SCM smob, SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (simple_vertical_skylines_from_extents, (SCM smob));
DECLARE_SCHEME_CALLBACK (vertical_skylines_from_stencil, (SCM smob));
DECLARE_SCHEME_CALLBACK (vertical_skylines_from_element_stencils, (SCM smob));
- DECLARE_SCHEME_CALLBACK (simple_horizontal_skylines_from_stencil, (SCM smob));
+ DECLARE_SCHEME_CALLBACK (pure_simple_horizontal_skylines_from_extents, (SCM smob, SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (simple_horizontal_skylines_from_extents, (SCM smob));
DECLARE_SCHEME_CALLBACK (horizontal_skylines_from_stencil, (SCM smob));
DECLARE_SCHEME_CALLBACK (horizontal_skylines_from_element_stencils, (SCM smob));
@@ -161,7 +163,7 @@ public:
virtual bool pure_is_visible (int start, int end) const;
bool check_cross_staff (Grob *common);
static bool less (Grob *g1, Grob *g2);
- static SCM internal_simple_skylines_from_stencil (SCM, Axis);
+ static SCM maybe_pure_internal_simple_skylines_from_extents (Grob *, Axis, bool, int, int, bool, bool);
static SCM internal_skylines_from_element_stencils (SCM, Axis);
};
diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh
index 55943c4b44..d012a77b07 100644
--- a/lily/include/multi-measure-rest.hh
+++ b/lily/include/multi-measure-rest.hh
@@ -28,6 +28,7 @@ class Multi_measure_rest
public:
DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (height, (SCM));
DECLARE_SCHEME_CALLBACK (percent, (SCM));
static void add_column (Grob *, Item *);
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
diff --git a/lily/include/self-alignment-interface.hh b/lily/include/self-alignment-interface.hh
index c3c7e9c878..dd69f86630 100644
--- a/lily/include/self-alignment-interface.hh
+++ b/lily/include/self-alignment-interface.hh
@@ -30,10 +30,8 @@ struct Self_alignment_interface
static SCM aligned_on_self (Grob *me, Axis a, bool pure, int start, int end);
static SCM centered_on_object (Grob *me, Axis a);
static SCM aligned_on_parent (Grob *me, Axis a);
- static SCM avoid_colliding_grobs (Grob *me, Axis a, Real offset);
static void set_center_parent (Grob *me, Axis a);
static void set_align_self (Grob *me, Axis a);
- static void avoid_x_collisions (Grob *me);
DECLARE_SCHEME_CALLBACK (x_aligned_on_self, (SCM element));
DECLARE_SCHEME_CALLBACK (y_aligned_on_self, (SCM element));
@@ -44,8 +42,6 @@ struct Self_alignment_interface
DECLARE_SCHEME_CALLBACK (centered_on_x_parent, (SCM element));
DECLARE_SCHEME_CALLBACK (centered_on_y_parent, (SCM element));
DECLARE_SCHEME_CALLBACK (x_centered_on_y_parent, (SCM element));
- DECLARE_SCHEME_CALLBACK (avoid_x_colliding_grobs, (SCM element, SCM offset));
- DECLARE_SCHEME_CALLBACK (x_colliding_grobs, (SCM element));
DECLARE_SCHEME_CALLBACK (aligned_on_x_parent, (SCM element));
DECLARE_SCHEME_CALLBACK (aligned_on_y_parent, (SCM element));
};
diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh
index edb6dc6a7a..e7c1637471 100644
--- a/lily/include/side-position-interface.hh
+++ b/lily/include/side-position-interface.hh
@@ -42,14 +42,11 @@ public:
static SCM aligned_side (Grob *me, Axis a, bool pure, int start, int end, Real *current_off_ptr);
- static SCM general_side_position (Grob *, Axis, bool, bool my_extents,
- bool pure, int start, int end, Real *current_off);
- static SCM skyline_side_position (Grob *me, Axis a, bool pure, int start, int end, Real *current_offset);
-
static Axis get_axis (Grob *);
static void set_axis (Grob *, Axis);
DECLARE_GROB_INTERFACE ();
static void add_support (Grob *, Grob *);
+ static void recursive_add_support (Grob *, Grob *);
static void add_staff_support (Grob *);
};
diff --git a/lily/include/skyline.hh b/lily/include/skyline.hh
index c300895fee..9a5473ddd5 100644
--- a/lily/include/skyline.hh
+++ b/lily/include/skyline.hh
@@ -92,6 +92,7 @@ public:
Real max_height_position () const;
Real left () const;
Real right () const;
+ Direction direction () const;
void set_minimum_height (Real height);
void clear ();
bool is_empty () const;