lilypond-1.3.130
[lilypond.git] / lily / super-elem.cc
blobfda20ea9eea3575a030a10816df14996ab0a42e6
1 /*
2 super-elem.cc -- implement Super_elem
4 source file of the LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "super-element.hh"
10 #include "line-of-score.hh"
11 #include "p-score.hh"
12 #include "string.hh"
13 #include "tex-outputter.hh"
15 void
16 Super_elem::handle_broken_dependencies()
18 lines_arr_ = line_of_score_l_->get_lines();
19 for (int i =0; i < lines_arr_.size(); i++)
20 add_dependency (lines_arr_[i]);
24 void
25 Super_elem::do_substitute_dependency (Score_element*o,Score_element* n)
27 if (line_of_score_l_ == o->access_Spanner ())
28 line_of_score_l_ = n? (Line_of_score*) n->access_Spanner () : 0;
31 Super_elem::Super_elem()
33 line_of_score_l_ = new Line_of_score ;
36 void
37 Super_elem::do_add_processing()
39 pscore_l_->typeset_unbroken_spanner (line_of_score_l_);
40 add_dependency (line_of_score_l_);
43 IMPLEMENT_IS_TYPE_B1(Super_elem,Score_element);
46 /**
47 for administration of what was done already
49 enum Score_element_status {
50 ORPHAN=0, // not yet added to pstaff
51 VIRGIN, // added to pstaff
52 PREBROKEN,
53 PRECALCING,
54 PRECALCED, // calcs before spacing done
55 SPACING,
56 SPACED,
57 BROKEN,
58 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
59 POSTCALCED, // after spacing calcs done
60 BREWING,
61 BREWED,
62 UNLINKING,
63 UNLINKED,
66 void
67 Super_elem::pre_processing ()
69 calcalute_dependencies (PRECALCING, PRECALCED, &Score_element::do_pre_processing);
72 void
73 Super_elem::space_processing ()
75 calcalute_dependencies (SPACING, SPACED, &Score_element::do_space_processing);
78 /* for break processing, use only one status, because copies have to
79 have correct status. (Previously,
80 Score_element::handle_[pre]broken_dependencies assigned to status_i_
82 void
83 Super_elem::breakable_col_processing ()
85 calcalute_dependencies (PREBROKEN, PREBROKEN, &Score_element::do_breakable_col_processing);
88 void
89 Super_elem::break_processing ()
91 calcalute_dependencies (BROKEN, BROKEN, &Score_element::do_break_processing);
93 void
94 Super_elem::post_processing ()
96 calcalute_dependencies (POSTCALCING, POSTCALCED, &Score_element::do_post_processing);
99 void
100 Super_elem::output_all ()
102 for (int i=0; i < lines_arr_.size(); i++)
104 pscore_l_->outputter_l_->start_line ();
105 lines_arr_[i]->calcalute_dependencies (BREWING, BREWED, &Score_element::do_brew_molecule);
106 pscore_l_->outputter_l_->stop_line ();
112 void
113 Super_elem::unlink_all ()
115 calcalute_dependencies (UNLINKING, UNLINKED, &Score_element::junk_links);