]> git.donarmstrong.com Git - lilypond.git/blob - src/item.cc
release: 0.0.18
[lilypond.git] / src / item.cc
1 #include "pstaff.hh"
2 #include "pscore.hh"
3 #include "symbol.hh"
4 #include "molecule.hh"
5 #include "pcol.hh"
6
7 void
8 Item::translate(Offset O)
9 {
10     offset_ += O;
11 }
12
13 void
14 Item::postprocess()
15 {
16     // default: do nothing
17 }
18
19
20 void
21 Item::preprocess()
22 {
23     // default: do nothing
24 }
25
26 String
27 Item::TeXstring() const
28 {
29     Item * me = (Item*) this;
30     output->translate(offset_); // ugh?
31     me ->offset_ = Offset(0,0); // URRGGH!
32     return output->TeXstring();
33 }
34
35 Interval
36 Item::width() const
37 {
38     Interval i =output->extent().x ;
39     if (!i.empty())             // float exception on DEC Alpha
40          i+=offset_.x;
41     return i;
42 }
43
44 Interval
45 Item::height() const
46 {
47     Interval i =output->extent().y;
48     return i+=offset_.y;
49 }
50
51 Item::~Item()
52 {
53     delete output;
54 }
55
56 Item::Item()
57 {
58     pcol_ = 0;
59     output = 0;
60     pstaff_ = 0;
61 }
62 void
63 Item::print() const
64 {
65 #ifndef NPRINT
66     if (output)
67         output->print();
68 #endif
69 }
70
71 Paperdef*
72 Item::paper()  const
73 {
74     assert(pstaff_);
75     return pstaff_->pscore_->paper_;
76 }
77