]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 1.1.29
[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 (paper()->internote_f () * y_position_i_);
22   change_b_ = (break_status_dir() != RIGHT);
23 }
24
25 /*
26   FIXME
27 */
28 Clef_item::Clef_item()
29 {
30   breakable_b_ =true;
31   default_b_ = false;
32   change_b_ = true;
33   octave_dir_ = CENTER;
34   symbol_ = "treble";
35   y_position_i_ = -2;
36 }
37
38 void
39 Clef_item::do_add_processing ()
40 {
41   if (!break_status_dir_)       // broken stuff takes care of their own texts
42     {
43       SCM defvis = gh_eval_str ("(lambda (d) (if (= d 1) '(#f . #f) '(#t . #t)))");
44       G_text_item *g =0;
45       if (octave_dir_)
46         {
47           g = new G_text_item;
48           pscore_l_->typeset_element (g);
49       
50           g->text_str_ = "8";
51           g->style_str_ = "italic";
52           g->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS];
53           g->dim_cache_[X_AXIS].parent_l_ = &dim_cache_[X_AXIS];
54           add_dependency (g);   // just to be sure.
55
56           Real r = do_height ()[octave_dir_] + g->extent (Y_AXIS)[-octave_dir_];
57           g->dim_cache_[Y_AXIS].set_offset (r);
58         }
59       if (default_b_)
60         {
61           visibility_lambda_ = defvis;
62           if (g)
63             g->visibility_lambda_ = defvis;
64         }
65     }
66
67
68 }
69
70
71
72
73
74 Molecule*
75 Clef_item::do_brew_molecule_p() const
76 {
77   String t = symbol_;
78   if  (change_b_)
79     t += "_change";
80
81   Molecule*output = new Molecule (lookup_l ()->clef (t));
82   return output;
83 }
84
85
86