]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-def.cc
patch::: 0.0.68pre.jcn1: Re: patsen?
[lilypond.git] / lily / paper-def.cc
1 /*
2   paper-def.cc -- implement Paper_def
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include <math.h>
10 #include "misc.hh"
11 #include "paper-def.hh"
12 #include "debug.hh"
13 #include "lookup.hh"
14 #include "dimen.hh"
15
16
17
18 Real
19 Paper_def::duration_to_dist(Moment d)
20 {
21     if (!d)
22         return 0;
23     
24     return whole_width * pow(geometric_, log_2(d));
25 }
26
27 Real
28 Paper_def::rule_thickness()const
29 {
30     return 0.4 PT;
31 }
32
33 Paper_def::Paper_def(Lookup *l)
34 {
35     lookup_p_ = l;
36     linewidth = 15 *CM_TO_PT;           // in cm for now
37     whole_width = 8 * note_width();
38     geometric_ = sqrt(2);
39     outfile = "lelie.tex";
40 }
41
42 Paper_def::~Paper_def()
43 {
44     delete lookup_p_;
45 }
46 Paper_def::Paper_def(Paper_def const&s)
47 {
48     lookup_p_ = new Lookup(*s.lookup_p_);
49     geometric_ = s.geometric_;
50     whole_width = s.whole_width;
51     outfile = s.outfile;
52     linewidth = s.linewidth;
53 }
54
55 void
56 Paper_def::set(Lookup*l)
57 {
58     assert(l != lookup_p_);
59     delete lookup_p_;
60     lookup_p_ = l;
61 }
62
63 Real
64 Paper_def::interline_f() const
65 {
66     return lookup_p_->ball(4).dim.y.length();
67 }
68
69 Real
70 Paper_def::interbeam_f() const
71 {
72     return lookup_p_->interbeam_f();
73 }
74 Real
75 Paper_def::internote_f() const
76 {
77     return lookup_p_->internote_f();
78 }
79 Real
80 Paper_def::note_width()const
81 {
82     return lookup_p_->ball(4).dim.x.length( );
83 }
84 Real
85 Paper_def::standard_height() const
86 {
87     return 20 PT;
88 }
89
90 void
91 Paper_def::print() const
92 {
93 #ifndef NPRINT
94     mtor << "Paper {width: " << print_dimen(linewidth);
95     mtor << "whole: " << print_dimen(whole_width);
96     mtor << "out: " <<outfile;
97     lookup_p_->print();
98     mtor << "}\n";
99 #endif
100 }
101 Lookup const *
102 Paper_def::lookup_l()
103 {
104     return lookup_p_;
105 }