]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
patch::: 1.1.37.mb2: Re: LilyPond 1.1.37
[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   SCM style_sym =get_elt_property (style_scm_sym);
23   String style;
24   if (style_sym != SCM_BOOL_F)
25     style = ly_scm2string (SCM_CDR(style_sym));
26   
27   if (break_status_dir() != RIGHT && style != "fullSizeChanges")
28     symbol_ += "_change";
29   if (style == "transparent")
30     set_elt_property (transparent_scm_sym, SCM_BOOL_T);
31 }
32
33 /*
34   FIXME
35 */
36 Clef_item::Clef_item()
37 {
38   set_elt_property (breakable_scm_sym, SCM_BOOL_T);
39
40   symbol_ = "treble";
41   y_position_i_ = -2;
42 }
43
44 void
45 Clef_item::do_add_processing ()
46 {
47   if (!break_status_dir ())     // broken stuff takes care of their own texts
48     {
49       G_text_item *g =0;
50
51       SCM octave_dir = remove_elt_property (octave_dir_scm_sym);
52       if (octave_dir != SCM_BOOL_F)
53         {
54           Direction d = Direction (gh_scm2int (SCM_CDR(octave_dir)));
55           g = new G_text_item;
56           pscore_l_->typeset_element (g);
57       
58           g->text_str_ = "8";
59           g->style_str_ = "italic";
60           g->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS];
61           g->dim_cache_[X_AXIS].parent_l_ = &dim_cache_[X_AXIS];
62           add_dependency (g);   // just to be sure.
63
64           Real r = do_height ()[d] + g->extent (Y_AXIS)[-d];
65           g->dim_cache_[Y_AXIS].set_offset (r);
66           g->set_elt_property (visibility_lambda_scm_sym,
67                                get_elt_property (visibility_lambda_scm_sym));
68         }
69
70     }
71 }
72
73 Molecule*
74 Clef_item::do_brew_molecule_p() const
75 {
76   Molecule*output = new Molecule (lookup_l ()->clef (symbol_));
77   return output;
78 }
79
80
81