2 notehead.cc -- implement Note_head
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "note-head.hh"
14 #include "paper-def.hh"
16 #include "molecule.hh"
17 #include "musical-request.hh"
20 Note_head::Note_head ()
23 staff_size_i_
= 8; // UGH
29 Note_head::do_pre_processing ()
31 // 8 ball looks the same as 4 ball:
34 if (dots_l_
) // move into Rhythmic_head?
35 dots_l_
->position_i_
= position_i_
;
38 IMPLEMENT_IS_TYPE_B1(Note_head
,Rhythmic_head
);
42 Note_head::compare (Note_head
*const &a
, Note_head
* const &b
)
44 return a
->position_i_
- b
->position_i_
;
48 Note_head::do_width () const
50 Atom a
= paper ()->lookup_l()->ball (balltype_i_
);
51 Interval i
= a
.dim_
[X_AXIS
];
52 i
+= x_dir_
* i
.length ();
57 Note_head::brew_molecule_p() const
60 Paper_def
*p
= paper();
61 Real inter_f
= p
->internote_f ();
64 int streepjes_i
= abs (position_i_
) < staff_size_i_
/2
66 : (abs(position_i_
) - staff_size_i_
/2) /2;
68 Atom s
= p
->lookup_l()->ball (balltype_i_
);
69 out
= new Molecule (Atom (s
));
70 out
->translate_axis (x_dir_
* s
.dim_
[X_AXIS
].length (), X_AXIS
);
74 int dir
= sign (position_i_
);
75 Atom streepje
= p
->lookup_l ()->streepje (balltype_i_
);
77 int parity
= (position_i_
% 2) ? 1 : 0;
80 for (int i
=0; i
< streepjes_i
; i
++)
83 s
.translate_axis (-dir
* inter_f
* (i
*2 + parity
),
89 out
->translate_axis (inter_f
*position_i_
, Y_AXIS
);