2 music-output-def.cc -- implement Music_output_def
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "dictionary.hh"
12 #include "music-output-def.hh"
13 #include "global-translator.hh"
15 #include "identifier.hh"
17 #include "lily-guile.hh"
20 Music_output_def::get_next_default_count () const
27 Music_output_def::Music_output_def ()
30 translator_p_dict_p_
= new Scope
;
33 Music_output_def::~Music_output_def ()
36 delete translator_p_dict_p_
;
39 Music_output_def::Music_output_def (Music_output_def
const &s
)
41 scope_p_
= new Scope (*s
.scope_p_
);
42 translator_p_dict_p_
= new Scope (*s
.translator_p_dict_p_
);
46 Music_output_def::assign_translator (Translator_group
*tp
)
48 String s
=tp
->type_str_
;
51 tp
->warning (_("Interpretation context with empty type"));
54 translator_p_dict_p_
->set (s
, new Translator_group_identifier (tp
, 0));
58 Music_output_def::find_translator_l (String name
) const
60 if (translator_p_dict_p_
->elem_b (name
))
61 return translator_p_dict_p_
->elem (name
)->access_content_Translator_group (false);
63 map
<String
, Translator
*>::const_iterator ki
64 =global_translator_dict_p
->find (name
);
66 if (ki
!= global_translator_dict_p
->end ())
74 Music_output_def::get_global_translator_p ()
76 Translator
* t
= find_translator_l ("Score");
78 error (_f ("can't find `%s' context", "Score"));
80 t
->output_def_l_
= this;
81 Global_translator
*g
= dynamic_cast <Global_translator
*> (t
);
88 Music_output_def::print () const
93 Music_output_def::get_default_output () const
95 if (safe_global_b
|| !scope_p_
->elem_b ("output"))
97 SCM s
= scope_p_
->scm_elem ("output");
101 return gh_string_p (s
) ? ly_scm2string (s
) : String ("");