lilypond-1.3.7
[lilypond.git] / lily / clef-item.cc
blob32a7d932739da3f72ac4ae5478bd42f60fed661a
1 /*
2 clef-item.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include <ctype.h>
10 #include "clef-item.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15 #include "text-item.hh"
16 #include "paper-score.hh"
17 #include "dimension-cache.hh"
19 void
20 Clef_item::do_pre_processing()
22 Staff_symbol_referencer::do_pre_processing();
23 SCM style_sym =get_elt_property ("style");
24 String style;
25 if (style_sym != SCM_UNDEFINED)
26 style = ly_scm2string (style_sym);
28 if (break_status_dir() != RIGHT && style != "fullSizeChanges")
29 symbol_ += "_change";
30 if (style == "transparent")
32 set_elt_property ("transparent", SCM_BOOL_T);
33 set_empty (true, X_AXIS);
38 FIXME
40 Clef_item::Clef_item()
42 set_elt_property ("breakable", SCM_BOOL_T);
44 symbol_ = "treble";
45 set_position(-2);
48 void
49 Clef_item::do_add_processing ()
51 if (!break_status_dir ()) // broken stuff takes care of their own texts
53 Text_item *g =0;
55 SCM octave_dir = remove_elt_property ("octave-dir");
56 if (octave_dir != SCM_UNDEFINED)
58 Direction d = Direction (gh_scm2int (octave_dir));
59 g = new Text_item;
60 pscore_l_->typeset_element (g);
62 g->text_str_ = "8";
63 g->set_elt_property ("style", gh_str02scm ("italic"));
64 g->set_parent (this, Y_AXIS);
65 g->set_parent (this, X_AXIS);
67 add_dependency (g); // just to be sure.
69 Real r = do_height ()[d] - g->extent (Y_AXIS)[-d];
70 g->dim_cache_[Y_AXIS]->set_offset (r);
72 SCM my_vis = get_elt_property ("visibility-lambda");
73 if (my_vis != SCM_UNDEFINED)
74 g->set_elt_property ("visibility-lambda", my_vis);
81 Molecule*
82 Clef_item::do_brew_molecule_p() const
84 Molecule*output = new Molecule (lookup_l ()->afm_find (String ("clefs-" + symbol_)));
86 return output;