lilypond-1.1.5
[lilypond.git] / src / paper.cc
blobec5fde415db6c0ce28a2e0d3926903b39db67ef3
1 #include <math.h>
2 #include "misc.hh"
3 #include "paper.hh"
4 #include "debug.hh"
5 #include "lookup.hh"
6 #include "dimen.hh"
10 // golden ratio
11 const Real PHI = (1+sqrt(5))/2;
13 // see Roelofs, p. 57
14 Real
15 Paperdef::duration_to_dist(Moment d)
17 return whole_width * pow(geometric_, log_2(d));
20 Real
21 Paperdef::rule_thickness()const
23 return 0.4 PT;
26 Paperdef::Paperdef(Lookup *l)
28 lookup_p_ = l;
29 linewidth = 15 *CM_TO_PT; // in cm for now
30 whole_width = 8 * note_width();
31 geometric_ = sqrt(2);
34 Paperdef::~Paperdef()
36 delete lookup_p_;
38 Paperdef::Paperdef(Paperdef const&s)
40 lookup_p_ = new Lookup(*s.lookup_p_);
41 geometric_ = s.geometric_;
42 whole_width = s.whole_width;
43 outfile = s.outfile;
44 linewidth = s.linewidth;
47 void
48 Paperdef::set(Lookup*l)
50 assert(l != lookup_p_);
51 delete lookup_p_;
52 lookup_p_ = l;
55 Real
56 Paperdef::interline() const
58 return lookup_p_->ball(4).dim.y.length();
61 Real
62 Paperdef::internote() const
64 return lookup_p_->internote();
66 Real
67 Paperdef::note_width()const
69 return lookup_p_->ball(4).dim.x.length( );
71 Real
72 Paperdef::standard_height() const
74 return 20 PT;
77 void
78 Paperdef::print() const
80 #ifndef NPRINT
81 mtor << "Paper {width: " << print_dimen(linewidth);
82 mtor << "whole: " << print_dimen(whole_width);
83 mtor << "out: " <<outfile;
84 mtor << "}\n";
85 #endif