summaryrefslogtreecommitdiff
path: root/lily/rest.cc
blob: 0028373cf5dfdd9ce5331ccc0d439ae9e78adff6 (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
/*
  rest.cc -- implement Rest

  source file of the GNU LilyPond music typesetter

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

#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
#include "rest.hh"
#include "dots.hh"
#include "axis-group-element.hh"
#include "p-score.hh"

void
Rest::do_add_processing ()
{
  if (balltype_i_ != 0 && balltype_i_ != 1)
    position_i_ -= 4;
  else if (balltype_i_ == 0)
    position_i_ += 2;

  Rhythmic_head::do_add_processing ();
  if (dots_l_ && balltype_i_ > 1)
    {
      dots_l_->position_i_ = position_i_ + 4;
    }
}

Rest::Rest ()
{
  position_i_ =0;
}

Molecule *
Rest::brew_molecule_p () const
{
  int staff_size_i_ = 8;
  bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&  
    (balltype_i_ == 0 || balltype_i_ == 1);
  
  Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
  Molecule * m = new Molecule ( Atom (s));
  m->translate_axis (position_i_ *  paper ()->internote_f (), Y_AXIS);
  return m;
}

IMPLEMENT_IS_TYPE_B1(Rest, Rhythmic_head);