2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2012 Han-Wen Nienhuys
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.
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.
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/>.
23 #include "std-vector.hh"
24 #include "lily-proto.hh"
25 #include "stem-info.hh"
26 #include "grob-interface.hh"
31 static vector<int> note_head_positions (Grob *);
32 static int duration_log (Grob *);
33 static void set_beaming (Grob *, int, Direction d);
34 static int get_beaming (Grob *, Direction d);
35 static Spanner *get_beam (Grob *);
36 static Grob *first_head (Grob *);
37 static Grob *last_head (Grob *);
38 static Drul_array<Grob *> extremal_heads (Grob *);
39 static Grob *support_head (Grob *);
40 static void add_head (Grob *me, Grob *n);
41 static Stem_info get_stem_info (Grob *);
42 static Real chord_start_y (Grob *);
43 static void set_stem_positions (Grob *, Real);
44 static void cache_pure_height (Grob *, Interval, Interval);
45 static Slice beam_multiplicity (Grob *);
46 static Direction get_default_dir (Grob *);
47 static Real thickness (Grob *);
48 static Real beam_end_corrective (Grob *);
49 static int head_count (Grob *);
50 static bool is_invisible (Grob *);
51 static bool is_normal_stem (Grob *);
52 static bool is_cross_staff (Grob *);
53 static Interval head_positions (Grob *);
54 static Interval internal_pure_height (Grob *, bool);
55 static Interval internal_height (Grob *, bool);
56 static bool is_valid_stem (Grob *);
57 static Grob *get_reference_head (Grob *);
58 static Real internal_calc_stem_end_position (Grob *, bool);
59 static Real internal_calc_stem_begin_position (Grob *, bool);
61 DECLARE_GROB_INTERFACE ();
62 static void set_spacing_hints (Grob *);
63 static Grob *flag (Grob *);
65 DECLARE_SCHEME_CALLBACK (print, (SCM));
66 DECLARE_SCHEME_CALLBACK (calc_default_direction, (SCM));
67 DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element));
68 DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
69 DECLARE_SCHEME_CALLBACK (calc_beaming, (SCM));
70 DECLARE_SCHEME_CALLBACK (calc_stem_begin_position, (SCM));
71 DECLARE_SCHEME_CALLBACK (pure_calc_stem_begin_position, (SCM, SCM, SCM));
72 DECLARE_SCHEME_CALLBACK (calc_stem_end_position, (SCM));
73 DECLARE_SCHEME_CALLBACK (pure_calc_stem_end_position, (SCM, SCM, SCM));
74 DECLARE_SCHEME_CALLBACK (calc_stem_info, (SCM));
75 DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
76 DECLARE_SCHEME_CALLBACK (width, (SCM smob));
77 DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
78 DECLARE_SCHEME_CALLBACK (height, (SCM));
79 DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));