]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/staff-symbol-referencer.hh
79d07cfe7c91f9c6e1df1de0c5c75074f1784dbf
[lilypond.git] / lily / include / staff-symbol-referencer.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1999--2012 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 STAFF_SYMBOL_REFERENCER_HH
21 #define STAFF_SYMBOL_REFERENCER_HH
22
23 #include "grob-interface.hh"
24 #include "lily-proto.hh"
25
26 /**
27    A notation object that needs access to variables of the staff (no
28    lines, leading).
29 */
30 class Staff_symbol_referencer
31 {
32 public:
33   DECLARE_GROB_INTERFACE ();
34   static bool ugly_hack (Grob *);
35   static void set_position (Grob *, Real);
36   static void pure_set_position (Grob *, Real);
37   DECLARE_SCHEME_CALLBACK (callback, (SCM element));
38
39   /**
40      Leading are the lead strips between the sticks (lines) of
41      typeface. ie. leading is vertical space.
42   */
43   static Real line_thickness (Grob *);
44   static Real staff_space (Grob *);
45   static Grob *get_staff_symbol (Grob *);
46   static bool on_line (Grob *, int);
47   static bool on_staff_line (Grob *, int);
48   static int line_count (Grob *);
49   static Real get_position (Grob *);
50   static Real pure_get_position (Grob *);
51
52   /**
53      Interval of staff lines.
54   */
55   static Interval staff_span (Grob *);
56
57   /**
58      Half of the height, in staff space, i.e. 2.0 for a normal staff.
59   */
60   static Real staff_radius (Grob *);
61
62   static int get_rounded_position (Grob *);
63   static int pure_get_rounded_position (Grob *);
64   static Interval extent_in_staff (Grob *);
65
66 private:
67   static void internal_set_position (Grob *, Real, bool);
68   static Real internal_get_position (Grob *, bool);
69 };
70
71 int compare_position (Grob *const &, Grob *const &);
72 bool position_less (Grob *const &, Grob *const &);
73 bool pure_position_less (Grob *const &, Grob *const &);
74 #endif /* STAFF_SYMBOL_REFERENCER_HH */
75