]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-element.cc
release: 1.1.42
[lilypond.git] / lily / axis-group-element.cc
1 /*
2   axis-group-element.cc -- implement Axis_group_element
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 "axis-group-element.hh"
10 #include "graphical-axis-group.hh"
11
12
13
14 Link_array<Score_element>
15 Axis_group_element::get_extra_dependencies() const
16 {
17   return elem_l_arr ();
18 }
19
20 Link_array<Score_element>
21 Axis_group_element::elem_l_arr () const
22 {  
23   /*
24     ugh. I know
25   */
26   Link_array<Score_element> r;
27   for (int i=0; i < elem_l_arr_.size (); i++)
28     r.push (dynamic_cast<Score_element*>(elem_l_arr_[i]));
29       
30   return r;
31 }
32
33 Link_array<Score_element> 
34 Axis_group_element::get_children ()
35 {
36   Link_array<Score_element> childs;
37   Link_array<Score_element> elems = elem_l_arr ();
38   for (int i=0; i < elems.size (); i++) 
39     {
40       Score_element* e = elems[i];
41       childs.push (e) ;
42       Axis_group_element * axis_group= dynamic_cast <Axis_group_element *> (e);
43       if (axis_group)
44         childs.concat (axis_group->get_children ());      
45     }
46   
47   return childs;
48 }
49
50 void
51 Axis_group_element::do_print() const
52 {
53   Graphical_axis_group::do_print();
54 }
55
56 Axis_group_element::Axis_group_element()
57 {
58   set_elt_property (transparent_scm_sym, SCM_BOOL_T);
59 }
60
61 void
62 Axis_group_element::set_axes (Axis a1, Axis a2)
63 {
64   Graphical_axis_group::set_axes (a1,a2);
65   dim_cache_[X_AXIS]->set_empty ((a1 != X_AXIS && a2 != X_AXIS));
66   dim_cache_[Y_AXIS]->set_empty ((a1 != Y_AXIS && a2 != Y_AXIS));
67 }
68
69
70 void
71 Axis_group_element::do_substitute_element_pointer (Score_element*o,
72                                                    Score_element*n)
73 {
74   int i;
75   while ((i = elem_l_arr_.find_i (o))>=0) 
76     if (n) 
77       elem_l_arr_[i] = n;
78     else
79       elem_l_arr_.del (i);
80 }
81
82 Interval
83 Axis_group_element::do_height () const
84 {
85   return Graphical_axis_group::extent (Y_AXIS);
86 }
87
88 Interval
89 Axis_group_element::do_width () const
90 {
91   return Graphical_axis_group::extent (X_AXIS);
92 }