OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 DECLARE_SCHEME_CALLBACK (calc_x_offset, (SCM)); | 42 DECLARE_SCHEME_CALLBACK (calc_x_offset, (SCM)); |
43 | 43 |
44 static SCM internal_calc_y_offset (SCM smob, bool pure); | 44 static SCM internal_calc_y_offset (SCM smob, bool pure); |
45 }; | 45 }; |
46 | 46 |
47 MAKE_SCHEME_CALLBACK (Flag, width, 1); | 47 MAKE_SCHEME_CALLBACK (Flag, width, 1); |
48 SCM | 48 SCM |
49 Flag::width (SCM smob) | 49 Flag::width (SCM smob) |
50 { | 50 { |
51 Grob *me = unsmob<Grob> (smob); | 51 Grob *me = unsmob<Grob> (smob); |
52 Stencil *sten = unsmob<Stencil> (me->get_property ("stencil")); | 52 Stencil *sten = unsmob<Stencil> (get_property (me, "stencil")); |
53 if (!sten) | 53 if (!sten) |
54 return ly_interval2scm (Interval (0.0, 0.0)); | 54 return ly_interval2scm (Interval (0.0, 0.0)); |
55 | 55 |
56 Grob *stem = me->get_parent (X_AXIS); | 56 Grob *stem = me->get_parent (X_AXIS); |
57 | 57 |
58 /* | 58 /* |
59 TODO: | 59 TODO: |
60 This reproduces a bad hard-coding that has been in the code for quite some t
ime: | 60 This reproduces a bad hard-coding that has been in the code for quite some t
ime: |
61 the bounding boxes for the flags are slightly off and need to be fixed. | 61 the bounding boxes for the flags are slightly off and need to be fixed. |
62 */ | 62 */ |
63 | 63 |
64 return ly_interval2scm (sten->extent (X_AXIS) - stem->extent (stem, X_AXIS)[RI
GHT]); | 64 return ly_interval2scm (sten->extent (X_AXIS) - stem->extent (stem, X_AXIS)[RI
GHT]); |
65 } | 65 } |
66 | 66 |
67 MAKE_SCHEME_CALLBACK (Flag, glyph_name, 1); | 67 MAKE_SCHEME_CALLBACK (Flag, glyph_name, 1); |
68 SCM | 68 SCM |
69 Flag::glyph_name (SCM smob) | 69 Flag::glyph_name (SCM smob) |
70 { | 70 { |
71 Grob *me = unsmob<Grob> (smob); | 71 Grob *me = unsmob<Grob> (smob); |
72 Grob *stem = me->get_parent (X_AXIS); | 72 Grob *stem = me->get_parent (X_AXIS); |
73 | 73 |
74 Direction d = get_grob_direction (stem); | 74 Direction d = get_grob_direction (stem); |
75 int log = Stem::duration_log (stem); | 75 int log = Stem::duration_log (stem); |
76 string flag_style; | 76 string flag_style; |
77 | 77 |
78 SCM flag_style_scm = me->get_property ("style"); | 78 SCM flag_style_scm = get_property (me, "style"); |
79 if (scm_is_symbol (flag_style_scm)) | 79 if (scm_is_symbol (flag_style_scm)) |
80 flag_style = ly_symbol2string (flag_style_scm); | 80 flag_style = ly_symbol2string (flag_style_scm); |
81 | 81 |
82 bool adjust = true; | 82 bool adjust = true; |
83 | 83 |
84 string staffline_offs; | 84 string staffline_offs; |
85 if (flag_style == "mensural") | 85 if (flag_style == "mensural") |
86 /* Mensural notation: For notes on staff lines, use different | 86 /* Mensural notation: For notes on staff lines, use different |
87 flags than for notes between staff lines. The idea is that | 87 flags than for notes between staff lines. The idea is that |
88 flags are always vertically aligned with the staff lines, | 88 flags are always vertically aligned with the staff lines, |
(...skipping 23 matching lines...) Expand all Loading... |
112 MAKE_SCHEME_CALLBACK (Flag, print, 1); | 112 MAKE_SCHEME_CALLBACK (Flag, print, 1); |
113 SCM | 113 SCM |
114 Flag::print (SCM smob) | 114 Flag::print (SCM smob) |
115 { | 115 { |
116 Grob *me = unsmob<Grob> (smob); | 116 Grob *me = unsmob<Grob> (smob); |
117 Grob *stem = me->get_parent (X_AXIS); | 117 Grob *stem = me->get_parent (X_AXIS); |
118 | 118 |
119 Direction d = get_grob_direction (stem); | 119 Direction d = get_grob_direction (stem); |
120 string flag_style; | 120 string flag_style; |
121 | 121 |
122 SCM flag_style_scm = me->get_property ("style"); | 122 SCM flag_style_scm = get_property (me, "style"); |
123 if (scm_is_symbol (flag_style_scm)) | 123 if (scm_is_symbol (flag_style_scm)) |
124 flag_style = ly_symbol2string (flag_style_scm); | 124 flag_style = ly_symbol2string (flag_style_scm); |
125 | 125 |
126 if (flag_style == "no-flag") | 126 if (flag_style == "no-flag") |
127 return Stencil ().smobbed_copy (); | 127 return Stencil ().smobbed_copy (); |
128 | 128 |
129 char dir = (d == UP) ? 'u' : 'd'; | 129 char dir = (d == UP) ? 'u' : 'd'; |
130 Font_metric *fm = Font_interface::get_default_font (me); | 130 Font_metric *fm = Font_interface::get_default_font (me); |
131 string font_char = robust_scm2string (me->get_property ("glyph-name"), ""); | 131 string font_char = robust_scm2string (get_property (me, "glyph-name"), ""); |
132 Stencil flag = fm->find_by_name (font_char); | 132 Stencil flag = fm->find_by_name (font_char); |
133 if (flag.is_empty ()) | 133 if (flag.is_empty ()) |
134 me->warning (_f ("flag `%s' not found", font_char)); | 134 me->warning (_f ("flag `%s' not found", font_char)); |
135 | 135 |
136 /* | 136 /* |
137 TODO: maybe property stroke-style should take different values, | 137 TODO: maybe property stroke-style should take different values, |
138 e.g. "" (i.e. no stroke), "single" and "double" (currently, it's | 138 e.g. "" (i.e. no stroke), "single" and "double" (currently, it's |
139 '() or "grace"). */ | 139 '() or "grace"). */ |
140 SCM stroke_style_scm = me->get_property ("stroke-style"); | 140 SCM stroke_style_scm = get_property (me, "stroke-style"); |
141 if (scm_is_string (stroke_style_scm)) | 141 if (scm_is_string (stroke_style_scm)) |
142 { | 142 { |
143 string stroke_style = ly_scm2string (stroke_style_scm); | 143 string stroke_style = ly_scm2string (stroke_style_scm); |
144 if (!stroke_style.empty ()) | 144 if (!stroke_style.empty ()) |
145 { | 145 { |
146 string font_char = flag_style + dir + stroke_style; | 146 string font_char = flag_style + dir + stroke_style; |
147 Stencil stroke = fm->find_by_name ("flags." + font_char); | 147 Stencil stroke = fm->find_by_name ("flags." + font_char); |
148 if (stroke.is_empty ()) | 148 if (stroke.is_empty ()) |
149 { | 149 { |
150 font_char = dir + stroke_style; | 150 font_char = dir + stroke_style; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 " what style of flag glyph is typeset on a" | 210 " what style of flag glyph is typeset on a" |
211 " @code{Stem}. Valid options include @code{'()}" | 211 " @code{Stem}. Valid options include @code{'()}" |
212 " for standard flags, @code{'mensural} and" | 212 " for standard flags, @code{'mensural} and" |
213 " @code{'no-flag}, which switches off the flag.", | 213 " @code{'no-flag}, which switches off the flag.", |
214 | 214 |
215 /* properties */ | 215 /* properties */ |
216 "glyph-name " | 216 "glyph-name " |
217 "style " | 217 "style " |
218 "stroke-style " | 218 "stroke-style " |
219 ); | 219 ); |
OLD | NEW |