lilypond-1.0.8
[lilypond.git] / src / paperdef.cc
blobf5c3bcdfae1765032605f8f236f731781d10390b
1 #include <math.h>
2 #include "misc.hh"
3 #include "paperdef.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 if (!d)
18 return 0;
20 return whole_width * pow(geometric_, log_2(d));
23 Real
24 Paperdef::rule_thickness()const
26 return 0.4 PT;
29 Paperdef::Paperdef(Lookup *l)
31 lookup_p_ = l;
32 linewidth = 15 *CM_TO_PT; // in cm for now
33 whole_width = 8 * note_width();
34 geometric_ = sqrt(2);
35 outfile = "lelie.out";
38 Paperdef::~Paperdef()
40 delete lookup_p_;
42 Paperdef::Paperdef(Paperdef const&s)
44 lookup_p_ = new Lookup(*s.lookup_p_);
45 geometric_ = s.geometric_;
46 whole_width = s.whole_width;
47 outfile = s.outfile;
48 linewidth = s.linewidth;
51 void
52 Paperdef::set(Lookup*l)
54 assert(l != lookup_p_);
55 delete lookup_p_;
56 lookup_p_ = l;
59 Real
60 Paperdef::interline() const
62 return lookup_p_->ball(4).dim.y.length();
65 Real
66 Paperdef::internote() const
68 return lookup_p_->internote();
70 Real
71 Paperdef::note_width()const
73 return lookup_p_->ball(4).dim.x.length( );
75 Real
76 Paperdef::standard_height() const
78 return 20 PT;
81 void
82 Paperdef::print() const
84 #ifndef NPRINT
85 mtor << "Paper {width: " << print_dimen(linewidth);
86 mtor << "whole: " << print_dimen(whole_width);
87 mtor << "out: " <<outfile;
88 mtor << "}\n";
89 #endif