]> git.donarmstrong.com Git - lilypond.git/blob - lily/break-align-item.cc
release: 1.1.45
[lilypond.git] / lily / break-align-item.cc
1 /*
2   break-align-item.cc -- implement Break_align_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "break-align-item.hh"
10 #include "dimensions.hh"
11 #include "p-score.hh"
12
13 void
14 Break_align_item::do_pre_processing()
15 {
16   align_dir_ = break_status_dir();
17   flip (&align_dir_);
18   Axis_align_item::do_pre_processing();
19 }
20
21
22
23
24 Break_align_item::Break_align_item ()
25 {
26   stacking_dir_ = RIGHT;
27   threshold_interval_[SMALLER] = 1.5 PT;
28   set_axis (X_AXIS);
29 }
30
31 void
32 Break_align_item::add_breakable_item (Item *it)
33 {
34   SCM pr = it->remove_elt_property (break_priority_scm_sym); 
35
36   if (pr == SCM_BOOL_F)
37     return;
38
39   int priority = gh_scm2int (SCM_CDR (pr));
40
41   Score_element * column_l = get_elt_by_priority (priority);
42   Axis_group_item * hg=0;
43   if (column_l)
44     {
45       hg = dynamic_cast<Axis_group_item*> (column_l);
46     }
47   else
48     {
49       hg = new Axis_group_item;
50       hg->set_axes (X_AXIS,X_AXIS);
51
52       /*
53         this is quite ridiculous, but we do this anyway, to ensure that no
54         warning bells about missing Y refpoints go off later on.
55       */
56       hg->dim_cache_[Y_AXIS]->parent_l_ = dim_cache_[Y_AXIS];
57       hg->set_elt_property (ly_symbol("origin"),
58                             SCM_EOL);
59
60       pscore_l_->typeset_element (hg);
61       add_element_priority (hg, priority);
62
63       if (priority == 0)
64         center_l_ = hg;
65     }
66       
67   hg->set_elt_property (ly_symbol("origin"),
68                         scm_cons (gh_str02scm (it->name()),
69                                   hg->get_elt_property (ly_symbol ("origin"))));
70   hg->add_element (it);
71
72
73 }