1 /* 2 This file is part of LilyPond, the GNU music typesetter. 3 4 Copyright (C) 2000--2021 Han-Wen Nienhuys <hanwen@xs4all.nl> 5 6 LilyPond is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 LilyPond is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef AXIS_GROUP_INTERFACE_HH 21 #define AXIS_GROUP_INTERFACE_HH 22 23 #include "lily-proto.hh" 24 #include "grob-interface.hh" 25 #include "skyline.hh" 26 27 #include <vector> 28 29 class Axis_group_interface 30 { 31 static Real default_outside_staff_padding_; 32 public: 33 static SCM generic_group_extent (Grob *me, Axis a); 34 static Real get_default_outside_staff_padding (); 35 static Interval generic_bound_extent (Grob *me, Grob *common, Axis a); 36 static Interval pure_group_height (Grob *me, int start, int end); 37 DECLARE_SCHEME_CALLBACK (width, (SCM smob)); 38 DECLARE_SCHEME_CALLBACK (calc_x_common, (SCM smob)); 39 DECLARE_SCHEME_CALLBACK (calc_y_common, (SCM smob)); 40 DECLARE_SCHEME_CALLBACK (height, (SCM smob)); 41 DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end)); 42 DECLARE_SCHEME_CALLBACK (calc_skylines, (SCM smob)); 43 DECLARE_SCHEME_CALLBACK (combine_skylines, (SCM smob)); 44 DECLARE_SCHEME_CALLBACK (print, (SCM smob)); 45 DECLARE_SCHEME_CALLBACK (adjacent_pure_heights, (SCM)); 46 DECLARE_SCHEME_CALLBACK (calc_staff_staff_spacing, (SCM)); 47 DECLARE_SCHEME_CALLBACK (calc_pure_staff_staff_spacing, (SCM, SCM, SCM)); 48 DECLARE_SCHEME_CALLBACK (calc_pure_relevant_grobs, (SCM)); 49 DECLARE_SCHEME_CALLBACK (calc_pure_y_common, (SCM)); 50 static SCM internal_calc_pure_relevant_grobs (Grob *, const std::string &); 51 static Interval relative_group_extent (std::vector<Grob *> const &list, 52 Grob *common, Axis); 53 static Interval relative_maybe_bound_group_extent (std::vector<Grob *> const &list, 54 Grob *common, Axis, bool); 55 static Interval relative_pure_height (Grob *me, int start, int end); 56 static Interval combine_pure_heights (Grob *me, SCM, vsize, vsize); 57 static Interval sum_partial_pure_heights (Grob *me, int, int); 58 static Interval begin_of_line_pure_height (Grob *me, vsize); 59 static Interval rest_of_line_pure_height (Grob *me, vsize, vsize); 60 static Interval part_of_line_pure_height (Grob *me, bool begin, vsize, vsize); 61 62 static Grob *outside_staff_ancestor (Grob *me); 63 static Skyline_pair skyline_spacing (Grob *me); 64 static void add_element (Grob *me, Grob *); 65 static void set_axes (Grob *, Axis, Axis); 66 static bool has_axis (Grob *, Axis); 67 static void get_children (Grob *, std::vector<Grob *> *); 68 static Interval staff_extent (Grob *me, Grob *ref, Axis, Grob *staff, Axis); 69 static SCM calc_common (Grob *, Axis); 70 static Real minimum_distance (Grob *, Grob *, Axis); 71 static SCM calc_maybe_pure_staff_staff_spacing (Grob *, bool, int, int); 72 }; 73 74 #endif /* AXIS_GROUP_INTERFACE_HH */ 75 76