]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 1.1.36
[lilypond.git] / lily / clef-item.cc
1 /*
2   clef-item.cc -- implement Clef_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
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 "g-text-item.hh"
16 #include "p-score.hh"
17
18 void
19 Clef_item::do_pre_processing()
20 {
21   dim_cache_[Y_AXIS].translate (y_position_i_ * staff_line_leading_f () / 2.0);
22   if (break_status_dir() != RIGHT)
23     {
24       symbol_ += "_change";    
25     }
26 }
27
28 /*
29   FIXME
30 */
31 Clef_item::Clef_item()
32 {
33   set_elt_property (breakable_scm_sym, SCM_BOOL_T);
34
35   symbol_ = "treble";
36   y_position_i_ = -2;
37 }
38
39 void
40 Clef_item::do_add_processing ()
41 {
42   if (!break_status_dir ())     // broken stuff takes care of their own texts
43     {
44       G_text_item *g =0;
45
46       SCM octave_dir = remove_elt_property (octave_dir_scm_sym);
47       if (octave_dir != SCM_BOOL_F)
48         {
49           Direction d = Direction (gh_int2scm (SCM_CDR(octave_dir)));
50           g = new G_text_item;
51           pscore_l_->typeset_element (g);
52       
53           g->text_str_ = "8";
54           g->style_str_ = "italic";
55           g->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS];
56           g->dim_cache_[X_AXIS].parent_l_ = &dim_cache_[X_AXIS];
57           add_dependency (g);   // just to be sure.
58
59           Real r = do_height ()[d] + g->extent (Y_AXIS)[-d];
60           g->dim_cache_[Y_AXIS].set_offset (r);
61           g->set_elt_property (visibility_lambda_scm_sym,
62                                get_elt_property (visibility_lambda_scm_sym));
63         }
64
65     }
66 }
67
68 Molecule*
69 Clef_item::do_brew_molecule_p() const
70 {
71   Molecule*output = new Molecule (lookup_l ()->clef (symbol_));
72   return output;
73 }
74
75
76