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