]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-item.cc
release: 1.1.24
[lilypond.git] / lily / text-item.cc
1 /*
2   text-item.cc -- implement Text_item
3
4   source file of the GNU LilyPond music typesetter
5   
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #if 0
10 #include "musical-request.hh"
11 #include "paper-def.hh"
12 #include "text-item.hh"
13 #include "stem.hh"
14 #include "molecule.hh"
15 #include "lookup.hh"
16 #include "debug.hh"
17
18
19 Text_item::Text_item (General_script_def* tdef_l, Direction d) 
20 {
21   dir_ = d;
22   fat_b_ = false;
23   tdef_p_ = tdef_l->clone ();
24 }
25
26 Text_item::~Text_item ()
27 {
28   delete tdef_p_;
29 }
30
31 void
32 Text_item::do_pre_processing ()
33 {
34   if (!dir_)
35     dir_ = DOWN;
36 }
37
38 Real
39 Text_item::get_position_f () const
40 {
41   // uhuh, tdef/gdef?
42   if (Text_def *tdl = dynamic_cast<Text_def*>(tdef_p_))
43     {
44       if (tdl->style_str_ != "finger") // HUHH?
45         return Staff_side::get_position_f ();
46     }
47
48   if (!dir_)
49     {
50       warning (_ ("Text_item::get_position_f(): "
51                  "somebody forgot to set my vertical direction, returning -20"));
52       return -20;
53     }
54
55   Interval v = support_extent ();
56   // add no extra: fingers should be just above note, no?
57   return v[dir_];
58 }
59
60 Interval
61 Text_item::symbol_height () const
62 {
63   return tdef_p_->get_atom (paper (), dir_).dim_.y ();
64 }
65   
66 Molecule*
67 Text_item::do_brew_molecule_p () const
68 {
69   Atom a (tdef_p_->get_atom (paper (), dir_));
70
71   if (!fat_b_)
72     a.dim_[X_AXIS] = Interval (0,0);
73   Molecule* mol_p = new Molecule (a);
74 #if 0
75   if (dir_<0)           // should do something better anyway.
76     mol_p->translate_axis (mol_p->extent ().y ().left , Y_AXIS);
77 #endif 
78   
79   mol_p->translate_axis (coordinate_offset_f_, Y_AXIS);
80
81 #if 0
82   // fine for one lyric, urg for lyric chord
83   mol_p->translate_axis (a.dim_.y ().length (), Y_AXIS);
84 #endif
85
86   return mol_p;
87 }
88
89
90
91 #endif