2 span-brace-item.cc -- implement Span_brace_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 Jan Nieuwenhuizen <jan@digicash.com>
10 #include "span-brace-item.hh"
13 #include "paper-def.hh"
14 #include "molecule.hh"
15 #include "vertical-align-elem.hh"
17 IMPLEMENT_STATIC_NAME(Span_brace_item);
18 IMPLEMENT_IS_TYPE_B1( Span_brace_item, Item );
21 Span_brace_item::add( Bar* b )
24 spanning_l_arr_.push( b );
29 Span_brace_item::do_substitute_dependency( Score_elem* o, Score_elem* n )
32 if ( o->is_type_b( Bar::static_name() ) )
33 bold = (Bar*)o->item();
39 if ( n && n->is_type_b( Bar::static_name() ) ) {
44 spanning_l_arr_.substitute( bold, b );
48 Span_brace_item::set( Vertical_align_element* a )
55 Span_brace_item::do_pre_processing()
57 if ( spanning_l_arr_.size () < 1 ) {
58 transparent_b_ = true;
61 else { // 0: nobreak, 1: pre, 2: post
62 empty_b_ = ( break_status_i() != 2 );
63 transparent_b_ = ( break_status_i() != 1 );
68 Span_brace_item::brew_molecule_p() const
71 for ( int i = 0; i < spanning_l_arr_.size(); i++ )
72 y.unite( spanning_l_arr_[ i ]->height() );
73 // ugh, one extra staff @ 16pt
74 // Real length_f = y.length() + spanning_l_arr_[ 0 ]->height().length();
75 // Real length_f = y.length() + 16;
76 Real length_f = y.length() - 6;
77 Symbol s = paper()->lookup_l()->vbrace( length_f );
78 Molecule* mol_p = new Molecule( Atom ( s ) );
79 // mol_p->translate_y( - ( length_f + 16 ) / 2 );
80 // urgh, what's wrong here?
81 mol_p->translate_y( - length_f / 2 - 6 );