summaryrefslogtreecommitdiff
path: root/lily/rhythmic-head.cc
blob: 436da6b612998f8c5dd6573f019248baefab4449 (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
/*
  rhythmic-head.cc -- implement Rhythmic_head

  source file of the GNU LilyPond music typesetter

  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/

#include "rhythmic-head.hh"

#include "warn.hh"
#include "rest.hh"
#include "stem.hh"
#include "staff-symbol-referencer.hh"
#include "item.hh"

Item *
Rhythmic_head::get_dots (Grob *me)
{
  SCM s = me->get_object ("dot");
  return unsmob_item (s);
}

Item *
Rhythmic_head::get_stem (Grob *me)
{
  SCM s = me->get_object ("stem");
  return unsmob_item (s);
}

int
Rhythmic_head::dot_count (Grob *me)
{
  return get_dots (me)
    ? scm_to_int (get_dots (me)->get_property ("dot-count")) : 0;
}

void
Rhythmic_head::set_dots (Grob *me, Item *dot)
{
  me->set_object ("dot", dot->self_scm ());
}

int
Rhythmic_head::duration_log (Grob *me)
{
  SCM s = me->get_property ("duration-log");
  return scm_is_number (s) ? scm_to_int (s) : 0;
}

ADD_INTERFACE (Rhythmic_head,
	       "Note head or rest.",
	       
	       /* properties */
	       "dot "
	       "duration-log "
	       "stem "
	       );