]> git.donarmstrong.com Git - lilypond.git/blob - lily/encompass-info.cc
release: 1.0.1
[lilypond.git] / lily / encompass-info.cc
1 /*
2   encompass-info.cc -- implement Encompass_info
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 */
9
10 #include "proto.hh"
11 #include "stem.hh"
12 #include "note-column.hh"
13 #include "paper-def.hh"
14 #include "encompass-info.hh"
15
16 Encompass_info::Encompass_info ()
17 {
18   assert (0);
19 }
20
21 Encompass_info::Encompass_info (Note_column const* note, Direction dir)
22 {
23   Paper_def* paper = note->paper ();
24   Real interline = paper->interline_f ();
25   Real notewidth = paper->note_width ();
26   Real internote = interline / 2;
27
28   Stem* stem = note->stem_l_;
29   /* 
30     set o_.x () to middle of notehead or on eo_.x ()act o_.x () position of stem,
31     according to slur direction
32        */
33   o_.x () = stem->hpos_f ();
34
35   if (stem->dir_ != dir)
36     {
37       o_.x () += 0.5 * notewidth;
38       // ugh
39       if (dir == DOWN)
40         o_.x () -= 0.5 * notewidth;
41       else
42         o_.x () += 0.5 * notewidth;
43     }
44   else if (stem->dir_ == UP)
45     o_.x () += 1.0 * notewidth;
46
47 //  o_.x () -= left_o_.x ();
48
49   o_.y () = stem->height ()[dir];
50
51   /*
52     leave a gap: slur mustn't touch head/stem
53    */
54   if (stem->dir_ != dir)
55     o_.y () += 3.0 * internote * dir;
56   else
57     o_.y () += 2.0 * internote * dir;
58
59   // ugh
60   if (dir == DOWN)
61     o_.y () += 1.5 * internote * dir;
62
63 //  o_.y () -= left_o_.y ();
64 }
65