From: fred Date: Sun, 24 Mar 2002 19:53:32 +0000 (+0000) Subject: lilypond-0.1.7 X-Git-Tag: release/1.5.59~4133 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9cf5a7aeb619d83de9a60e85ec7dbcd985c21bfc;p=lilypond.git lilypond-0.1.7 --- diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index 39c0615262..82a6fbfe3d 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -15,6 +15,8 @@ #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem) + + /** Both Spanner and Item are Score_elem's. Most Score_elem's depend on other Score_elem's, eg, Beam needs to know and set direction of Stem. So the Beam has to be calculated *before* Stem. This is @@ -29,11 +31,6 @@ class Score_elem : private Directed_graph_node { Molecule *output; // should scrap, and use temp var? - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; /** for administration of what was done already @@ -56,12 +53,26 @@ class Score_elem : private Directed_graph_node { Status status_; + Score_elem* dependency(int) const; + Score_elem* dependent(int) const; + int dependent_size() const; + int dependency_size() const; public: - PScore *pscore_l_; - Vertical_group *y_group_l_; - Horizontal_group *x_group_l_; + /** + This is needed, because #output# may still be + NULL. + */ + Offset offset_; + + + + + Paper_score *pscore_l_; + Axis_group_element * axis_group_l_a_[2]; + Score_elem(Score_elem const&); virtual String TeX_string () const ; + String TeX_string_without_offset(Offset)const; virtual void print() const; Paper_def *paper() const; @@ -70,17 +81,24 @@ public: Score_elem(); DECLARE_MY_RUNTIME_TYPEINFO; + Interval extent(Axis)const; Interval width() const; Interval height() const; - virtual void translate_x(Real); - virtual void translate_y(Real); Status status() const; /** translate the symbol. The symbol does not have to be created yet. */ void translate(Offset); - Offset offset()const; + /** + translate in one direction + */ + + void translate(Real, Axis); + Real relative_coordinate(Axis_group_element*, Axis)const; + Offset absolute_offset()const; + Real absolute_coordinate(Axis)const; + Axis_group_element*common_group(Score_elem const* s, Axis a)const; void add_processing(); void OK() const; @@ -91,6 +109,9 @@ public: void post_processing(); void molecule_processing(); + /** + Remove all links (dependencies, dependents, Axis_group_elements. + */ void unlink(); void unlink_all(); void substitute_dependency(Score_elem*,Score_elem*); @@ -109,19 +130,12 @@ public: /* virtual accessors */ - virtual Vertical_group * vertical_group() { return 0; } - virtual Horizontal_group * horizontal_group() { return 0; } virtual Spanner* spanner() { return 0; } - virtual Horizontal_vertical_group* elem_group() { return 0; } virtual Item * item() { return 0; } virtual Line_of_score * line_l() const; SCORE_ELEM_CLONE(Score_elem); - Score_elem* dependency(int) const; - Score_elem* dependent(int) const; - int dependent_size() const; - int dependency_size() const; - + /// no dimension, translation is noop bool empty_b_; /// do not print anything black @@ -135,7 +149,7 @@ protected: virtual void do_print() const {} /// generate the molecule virtual Molecule* brew_molecule_p()const; - ///executed directly after the item is added to the PScore + ///executed directly after the item is added to the Paper_score virtual void do_add_processing(); /// do calculations before determining horizontal spacing virtual void do_pre_processing(); @@ -149,9 +163,8 @@ protected: virtual void do_break_processing(); virtual void handle_broken_dependencies(); virtual void handle_prebroken_dependencies(); - - - + virtual Link_array get_extra_dependencies()const; + virtual void do_unlink(); }; diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 24430729bd..1c9a8ba159 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -43,15 +43,6 @@ Span_bar::do_substitute_dependency(Score_elem*o, Score_elem*n) spanning_l_arr_.substitute( bold , b); } -/* - A no-op if not yet output: the span_bar slavish follows what it spans - */ -void -Span_bar::translate_y(Real y) -{ - if (status() == OUTPUT) - Score_elem::translate_y(y); -} void Span_bar::set(Vertical_align_element *a) @@ -63,7 +54,7 @@ Span_bar::set(Vertical_align_element *a) Interval Span_bar::do_width() const { - return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x; // ugh + return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x(); // ugh } void Span_bar::do_pre_processing() @@ -91,18 +82,31 @@ Span_bar::get_bar_sym(Real dy) const return paper()->lookup_l()->bar(type_str_, dy); } + Molecule* Span_bar::brew_molecule_p()const { - Interval y; - for (int i=0; i < spanning_l_arr_.size(); i++) - y.unite( spanning_l_arr_[i]->height() ); - Symbol s = get_bar_sym(y.length()); - Molecule*output = new Molecule(Atom(s)); - output->translate_y ( y[-1] ); + Interval y_int; + for (int i=0; i < spanning_l_arr_.size(); i++) { + Axis_group_element *common = + common_group(spanning_l_arr_[i], Y_AXIS); + + Real y = spanning_l_arr_[i]->relative_coordinate(common, Y_AXIS) + -relative_coordinate(common,Y_AXIS); + + y_int.unite( y + spanning_l_arr_[i]->height() ); + } + Symbol s = get_bar_sym(y_int.length()); + Molecule*output = new Molecule(Atom(s)); + output->translate ( y_int[-1], Y_AXIS ); return output; } IMPLEMENT_IS_TYPE_B1(Span_bar,Bar); + +Span_bar::Span_bar() +{ + type_str_ = ""; +}