2 system-start-delimiter.cc -- implement System_start_delimiter
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "system-start-delimiter.hh"
12 #include "paper-def.hh"
13 #include "molecule.hh"
14 #include "axis-group-interface.hh"
16 #include "all-font-metrics.hh"
19 System_start_delimiter::staff_bracket (Real height) const
21 Paper_def* p= paper_l ();
22 Real arc_height = p->get_var("bracket_arch_height");
23 SCM at = gh_list (ly_symbol2scm ("bracket"),
24 gh_double2scm (p->get_var("bracket_arch_angle")),
25 gh_double2scm (p->get_var("bracket_arch_width")),
26 gh_double2scm (arc_height),
27 gh_double2scm (p->get_var("bracket_width")),
28 gh_double2scm (height),
29 gh_double2scm (p->get_var("bracket_arch_thick")),
30 gh_double2scm (p->get_var("bracket_thick")),
33 Real staff_space = p->get_var ("interline");
34 Real h = height + 2 * arc_height;
35 Box b (Interval (0, 1.5 * staff_space), Interval (-h/2, h/2));
38 mol.translate_axis (- mol.dim_[X_AXIS].length () / 2, X_AXIS);
42 System_start_delimiter::System_start_delimiter ()
48 System_start_delimiter::simple_bar (Real h) const
50 Real w = paper_l ()->get_var ("barthick_score");
51 return lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
56 System_start_delimiter::do_brew_molecule ()const
58 Interval ext = Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);
59 Real l = ext.length ();
62 SCM s = get_elt_property ("collapse-height");
63 if (gh_number_p (s) && l < gh_scm2double (s))
65 System_start_delimiter * me = (System_start_delimiter*)this;
66 me->set_elt_property ("transparent", SCM_BOOL_T);
67 me->set_empty (X_AXIS);
68 me->set_empty (Y_AXIS);
73 s = get_elt_property ("glyph");
74 if (gh_symbol_p (s) && s == ly_symbol2scm ("bracket"))
75 m = staff_bracket (l);
76 else if (gh_symbol_p (s) && s == ly_symbol2scm ("brace"))
82 m.translate_axis (ext.center (), Y_AXIS);
90 System_start_delimiter::staff_brace (Real y) const
92 Real staffht = paper_l ()->get_var ("staffheight");
93 int staff_size = int (rint (staffht ));
97 int minht = 2 * staff_size;
98 int maxht = 7 * minht;
99 int idx = int (((maxht - step) <? y - minht) / step);
102 SCM l = scm_eval (gh_list (ly_symbol2scm ("style-to-cmr"),
103 ly_str02scm ("brace"),
106 String nm = "feta-braces";
108 nm = ly_scm2string (gh_cdr (l));
109 nm += to_str (staff_size);
110 SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
113 at = fontify_atom (find_font (nm), at);
115 Box b (Interval (0,0), Interval (-y/2, y/2));
117 return Molecule(b, at);