2 music-output-def.cc -- implement Music_output_def
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "music-output-def.hh"
11 #include "global-translator.hh"
12 #include "dictionary-iter.hh"
14 IMPLEMENT_IS_TYPE_B(Music_output_def
);
16 Music_output_def::Music_output_def ()
20 Music_output_def::~Music_output_def ()
22 for (Dictionary_iter
<Translator
*> i (translator_p_dict_
); i
.ok (); i
++)
26 Music_output_def::Music_output_def (Music_output_def
const &s
)
28 for (Dictionary_iter
<Translator
*> i (s
.translator_p_dict_
); i
.ok (); i
++)
29 assign_translator (i
.key (), i
.val ()->clone ());
33 Music_output_def::find_translator_l (String name
) const
35 if (translator_p_dict_
.elt_b (name
))
36 return translator_p_dict_
[name
];
38 if (global_translator_dict_p
->elt_b (name
))
39 return (*global_translator_dict_p
)[name
];
46 Music_output_def::get_global_translator_p ()
48 Translator
* t
= find_translator_l ("Score")->clone ();
49 Global_translator
*g
= t
->group_l ()->global_l ();
57 Music_output_def::assign_translator (String s
, Translator
*t
)
60 t
->output_def_l_
= this;
61 if (translator_p_dict_
.elt_b (s
))
62 delete translator_p_dict_
[s
];
63 translator_p_dict_
[s
] = t
;
67 Music_output_def::print () const
70 for (Dictionary_iter
<Translator
*> i (translator_p_dict_
); i
.ok (); i
++)
72 DOUT
<< i
.key () << " = ";