From: fred Date: Sun, 24 Mar 2002 20:12:33 +0000 (+0000) Subject: lilypond-1.0.1 X-Git-Tag: release/1.5.59~3053 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=14341eba9af1a549d3f254805f772070c6687bfd;p=lilypond.git lilypond-1.0.1 --- diff --git a/lily/graphical-axis-group.cc b/lily/graphical-axis-group.cc new file mode 100644 index 0000000000..b0aab89df0 --- /dev/null +++ b/lily/graphical-axis-group.cc @@ -0,0 +1,90 @@ +/* + axis-group.cc -- implement Graphical_axis_group + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Han-Wen Nienhuys +*/ +#include "interval.hh" +#include "graphical-axis-group.hh" +#include "axis-group-element.hh" +#include "graphical-element.hh" +#include "debug.hh" + +/** don't copy anything: an element can only be in one + Graphical_axis_group at one time. */ +Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s) +{ + axis1_ = s.axis1_; + axis2_ = s.axis2_; +} + +bool +Graphical_axis_group::contains_b (Graphical_element const *e) const +{ + return elem_l_arr_.find_l (e); +} + +Interval +Graphical_axis_group::extent (Axis axis) const +{ + Interval r; + for (int i=0; i < elem_l_arr_.size(); i++) + r.unite (elem_l_arr_[i]->extent (axis)); + return r; +} + +void +Graphical_axis_group::add_element (Graphical_element*e) +{ + Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_]; + Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_]; + + assert (!g1 || g1 == this); + assert (!g2 || g2 == this); + g1 = this; + g2 = this; + elem_l_arr_.push (e); +} + + + +void +Graphical_axis_group::remove_element (Graphical_element*e) +{ + assert (contains_b (e)); + elem_l_arr_.unordered_substitute (e,0); + + e->axis_group_l_a_[axis1_] = 0; + e->axis_group_l_a_[axis2_] = 0; +} + +void +Graphical_axis_group::remove_all () +{ + for (int i=0; i < elem_l_arr_.size(); i++) + { + Graphical_element*e=elem_l_arr_[i]; + e->axis_group_l_a_[axis1_] = 0; + e->axis_group_l_a_[axis2_] = 0; + } + elem_l_arr_.clear (); +} + + +void +Graphical_axis_group::do_print() const +{ +#ifndef NPRINT + for (int i=0; i < elem_l_arr_.size(); i++) + DOUT << elem_l_arr_[i]->name () << " "; +#endif +} + +Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2) +{ + axis1_ =a1; + axis2_ = a2; +} + +IMPLEMENT_IS_TYPE_B1(Graphical_axis_group, Graphical_element); diff --git a/lily/horizontal-vertical-group-item.cc b/lily/horizontal-vertical-group-item.cc index dd40fb8182..cf1917228c 100644 --- a/lily/horizontal-vertical-group-item.cc +++ b/lily/horizontal-vertical-group-item.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ @@ -17,3 +17,9 @@ Horizontal_vertical_group_item::do_print() const } IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item); + +Horizontal_vertical_group_item::Horizontal_vertical_group_item () +{ + axis1_ = X_AXIS; + axis2_ = Y_AXIS; +}