lilypond-0.0.27
[lilypond.git] / src / paper.cc
blob09fd19aad43efbf79ed6face06b89a6d40426a8f
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 convert_dimen(0.4, "pt");
26 Paperdef::Paperdef(Lookup *l)
28 lookup_p_ = l;
30 linewidth = convert_dimen(15,"cm"); // in cm for now
31 whole_width = 8 * note_width();
32 geometric_ = sqrt(2);
35 Paperdef::~Paperdef()
37 delete lookup_p_;
39 Paperdef::Paperdef(Paperdef const&s)
41 lookup_p_ = new Lookup(*s.lookup_p_);
42 geometric_ = s.geometric_;
43 whole_width = s.whole_width;
44 outfile = s.outfile;
45 linewidth = s.linewidth;
48 void
49 Paperdef::set(Lookup*l)
51 assert(l != lookup_p_);
52 delete lookup_p_;
53 lookup_p_ = l;
56 Real
57 Paperdef::interline() const
59 return lookup_p_->ball(4).dim.y.length();
62 Real
63 Paperdef::internote() const
65 return lookup_p_->internote();
67 Real
68 Paperdef::note_width()const
70 return lookup_p_->ball(4).dim.x.length( );
72 Real
73 Paperdef::standard_height() const
75 return convert_dimen(20,"pt");
78 void
79 Paperdef::print() const
81 #ifndef NPRINT
82 mtor << "Paper {width: " << print_dimen(linewidth);
83 mtor << "whole: " << print_dimen(whole_width);
84 mtor << "out: " <<outfile;
85 mtor << "}\n";
86 #endif