blob: f26cfc4c51d1d026302d22fb59204f569181d1ad (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
notehead.cc -- implement Note_head
source file of the GNU LilyPond music typesetter
(c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "misc.hh"
#include "dots.hh"
#include "note-head.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "lookup.hh"
#include "molecule.hh"
#include "musical-request.hh"
Note_head::Note_head ()
{
x_dir_ = CENTER;
staff_size_i_= 8; // UGH
steps_i_ = 0;
position_i_ = 0;
extremal_i_ = 0;
}
void
Note_head::do_pre_processing ()
{
// 8 ball looks the same as 4 ball:
if (balltype_i_ > 2)
balltype_i_ = 2;
if (dots_l_) // move into Rhythmic_head?
dots_l_->position_i_ = position_i_;
}
int
Note_head::compare (Note_head *const &a, Note_head * const &b)
{
return a->position_i_ - b->position_i_;
}
Interval
Note_head::do_width () const
{
Atom a = lookup_l ()->ball (balltype_i_);
Interval i = a.dim_[X_AXIS];
i+= x_dir_ * i.length ();
return i;
}
Molecule*
Note_head::do_brew_molecule_p() const
{
Molecule*out = 0;
Paper_def *p = paper();
Real inter_f = p->internote_f ();
// ugh
int streepjes_i = abs (position_i_) < staff_size_i_/2
? 0
: (abs(position_i_) - staff_size_i_/2) /2;
//Atom s = lookup_l()->ball (balltype_i_);
Atom s; // = lookup_l()->ball (balltype_i_);
if (note_head_type_str_.length_i ()) {
if (note_head_type_str_ == "normal")
note_head_type_str_ = "";
s = lookup_l()->special_ball (balltype_i_, note_head_type_str_);
}
else
s = lookup_l()->ball (balltype_i_);
out = new Molecule (Atom (s));
out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
//out = new Molecule (Atom (s));
//out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
if (streepjes_i)
{
int dir = sign (position_i_);
Atom streepje = lookup_l ()->streepje (balltype_i_);
int parity = (position_i_ % 2) ? 1 : 0;
for (int i=0; i < streepjes_i; i++)
{
Atom s = streepje;
s.translate_axis (-dir * inter_f * (i*2 + parity),
Y_AXIS);
out->add_atom (s);
}
}
out->translate_axis (inter_f*position_i_, Y_AXIS);
return out;
}
|