From: fred Date: Tue, 26 Mar 2002 23:09:52 +0000 (+0000) Subject: lilypond-1.3.37 X-Git-Tag: release/1.5.59~1734 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=49e78fc11b96e3b1f3ebc96cd6e4db903617c2f2;p=lilypond.git lilypond-1.3.37 --- diff --git a/lily/collision.cc b/lily/collision.cc index f423d2a4a2..c25f45d05c 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -15,13 +15,14 @@ Collision::Collision() { - axis_group (this).set_axes (X_AXIS, Y_AXIS); + Axis_group_interface (this).set_interface (); + Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS); } void Collision::add_column (Note_column* ncol_l) { - axis_group (this).add_element (ncol_l); + Axis_group_interface (this).add_element (ncol_l); add_dependency (ncol_l); } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 29a5789a22..2dc724e9f6 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -16,6 +16,7 @@ #include "axis-group-interface.hh" +// todo: dots and elements duplicate each other. void Dot_column::add_dots (Dots *d) { @@ -23,7 +24,7 @@ Dot_column::add_dots (Dots *d) gi.add_element (d); add_dependency (d); - axis_group (this).add_element (d); + Axis_group_interface (this).add_element (d); } void @@ -51,9 +52,10 @@ Dot_column::Dot_column () { Group_interface gi (this, "dots"); gi.set_interface (); - directional_element (this).set (RIGHT); - axis_group (this).set_axes(X_AXIS,X_AXIS); + + Axis_group_interface (this).set_interface (); + Axis_group_interface (this).set_axes(X_AXIS,X_AXIS); } /* diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index aa2e6392bc..09c7cfafd0 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -1,22 +1 @@ -/* - axis-item.hh -- declare Axis_group_item - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef AXIS_ITEM_HH -#define AXIS_ITEM_HH - -#include "item.hh" - -class Axis_group_item : public virtual Item -{ -public: - Axis_group_item (); - VIRTUAL_COPY_CONS(Score_element); -}; - -#endif // AXIS_ITEM_HH +#error diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index 9d48108c2e..65296f8106 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -1,27 +1,2 @@ -/* - axis-group-spanner.hh -- declare Axis_group_spanner - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef AXIS_GROUP_SPANNER_HH -#define AXIS_GROUP_SPANNER_HH - -#include "spanner.hh" - -/** - An element which groups a line in a certain direction. The most - useful example of this is the Vertical_group_spanner -*/ -class Axis_group_spanner : public virtual Spanner - -{ -public: - Axis_group_spanner (); - VIRTUAL_COPY_CONS(Score_element); -}; - -#endif // SPAN_AXIS_GROUP_HH +#error diff --git a/lily/include/collision.hh b/lily/include/collision.hh index f64db66504..64052db5e0 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -10,7 +10,7 @@ #ifndef COLLISION_HH #define COLLISION_HH #include "lily-proto.hh" -#include "axis-group-item.hh" +#include "item.hh" #include "tuple.hh" //junkme, use SCM conses. @@ -24,7 +24,8 @@ typedef Tuple Shift_tup; multistaff support (see Chlapik: equal noteheads should be on the same hpos.) */ -class Collision : public Axis_group_item { +class Collision : public Item +{ protected: Array automatic_shift (); Array forced_shift (); diff --git a/lily/include/dot-column.hh b/lily/include/dot-column.hh index 9679bf32a4..4c3a211557 100644 --- a/lily/include/dot-column.hh +++ b/lily/include/dot-column.hh @@ -10,13 +10,13 @@ #ifndef DOT_COLUMN_HH #define DOT_COLUMN_HH -#include "axis-group-item.hh" +#include "item.hh" /** Group dots. This is needed because, the dots have to be aligned per voice */ -class Dot_column : public Axis_group_item +class Dot_column : public Item { static int compare (Dots * const&,Dots * const&); void add_dots (Dots*); diff --git a/lily/include/hara-kiri-vertical-group-spanner.hh b/lily/include/hara-kiri-vertical-group-spanner.hh index e3e34c2a00..aeb77bf9b8 100644 --- a/lily/include/hara-kiri-vertical-group-spanner.hh +++ b/lily/include/hara-kiri-vertical-group-spanner.hh @@ -10,14 +10,14 @@ #ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH #define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH -#include "axis-group-spanner.hh" +#include "spanner.hh" /** As Vertical_group_spanner, but keep track of interesting items. If we don't contain any interesting items after linebreaking, then gracefully commit suicide. Objective: don't disgrace Lily by typesetting empty lines in orchestral scores. */ -class Hara_kiri_group_spanner : public Axis_group_spanner +class Hara_kiri_group_spanner : public Spanner { public: Hara_kiri_group_spanner (); diff --git a/lily/include/item.hh b/lily/include/item.hh index c4b3dfbad3..0f2c951ca4 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -24,31 +24,27 @@ NB. This doesn't mean an Item has to initialize the output field before spacing calculation. - - @signature - visibility_lambda :: int -> (bool . bool) - - @in - break direction - - @out - (transparent, empty) cons - - */ -class Item : public virtual Score_element { - void do_break (); - void try_visibility_lambda (); -public: - /* - ugh. + Element properties + + visibility-lambda -- a function that takes the break + direction and returns a (transparent, empty) cons + + breakable -- boolean indicating if this is a breakable item (clef, + barline, key sig, etc.) + */ +class Item : public Score_element +{ Drul_array broken_to_drul_; - + void do_break (); + void try_visibility_lambda (); public: + VIRTUAL_COPY_CONS(Score_element); + Item(); + Item (Item const &); - /// I am really to be broken? bool breakable_b () const; bool broken_b () const; @@ -57,18 +53,10 @@ public: Item * find_broken_piece (Direction) const; Score_element * find_broken_piece (Line_of_score*) const; - Item(); - Real hpos_f() const; - virtual Line_of_score * line_l() const; virtual Paper_column * column_l () const; - - static int left_right_compare (Item const *, Item const*); - - Item (Item const &); protected: virtual void do_breakable_col_processing(); - void copy_breakable_items(); }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 8309d245a9..1b85d39f98 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -34,10 +34,6 @@ struct Audio_tie; struct Audio_time_signature; struct Auto_beam_engraver; struct Axis_align_item; -struct Axis_group; -struct Axis_group_element; -struct Axis_group_item; -struct Axis_group_spanner; struct Bar; struct Bar_column; struct Bar_column_engraver; @@ -273,7 +269,6 @@ struct Tremolo_req; struct Tuplet_spanner; struct Unfolded_repeat_iterator; struct Vertical_brace; -struct Vertical_spanner; struct Volta_spanner; struct Moment; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 994a50b20d..a5a0174d19 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -8,13 +8,34 @@ #define SCORELINE_HH #include "column-x-positions.hh" -#include "axis-group-spanner.hh" -#include "super-element.hh" +#include "spanner.hh" /// the columns of a score that form one line. FIXME: multiple inheritance -class Line_of_score : public Axis_group_spanner, public Super_element +class Line_of_score : public Spanner { public: + + +/* + imported the following from Super_element + + The toplevel element. The Paper_score contains this element, and any + element shoud be a dependency for the super element. + + It is the entry point for the "constraint solver"/ dependency + tracker. Every XXXX_processing () call traverses the entire + dependency graph, and calls the appropriate + Score_element::do_XXX_processing function on each Score_element it encounters. + + + FIXME: remove this class, to eliminate multiple inheritance. Merge + with Line_of_score ? */ + void space_processing (); + void pre_processing(); + void breakable_col_processing(); + void post_processing(); + void output_all (); + int rank_i_; Line_of_score(); @@ -30,7 +51,6 @@ public: void add_column (Paper_column*); protected: - virtual void do_print() const; VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index df0876b598..0d81e99399 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -11,15 +11,15 @@ #define NOTE_COLUMN_HH #include "item.hh" -#include "axis-group-item.hh" /** a struct for treating a group of noteheads (noteheads, stem - (chord) and scripts) as a single entity. */ -class Note_column : public Axis_group_item { + (chord) and scripts) as a single entity. +*/ +class Note_column : public Item +{ protected: virtual void after_line_breaking () ; public: - static int shift_compare (Note_column *const &, Note_column*const&); /** The relative position of the "voice" containing this diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 16b0585057..e0510bc7f8 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -10,7 +10,7 @@ #ifndef P_COL_HH #define P_COL_HH -#include "axis-group-item.hh" +#include "item.hh" #include "rod.hh" #include "spring.hh" @@ -27,7 +27,8 @@ \end{itemize} */ -class Paper_column : public Axis_group_item { +class Paper_column : public Item +{ public: VIRTUAL_COPY_CONS(Score_element); Drul_array > minimal_dists_arr_drul_; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 130604b863..b67d63d7dc 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -20,13 +20,10 @@ class Axis_group_spanner; Examples - \begin{itemize} - \item (de)crescendo - \item slur - \item beam - \item bracket - \end{itemize} - + * (de)crescendo + * slur + * beam + * bracket Spanner should know about the items which it should consider: e.g. slurs should be steep enough to "enclose" all those items. This @@ -34,7 +31,7 @@ class Axis_group_spanner; length of stems of notes they encompass. */ -class Spanner : public virtual Score_element { +class Spanner : public Score_element { Drul_array spanned_drul_; public: diff --git a/lily/include/super-element.hh b/lily/include/super-element.hh index 8c574bb683..3ae4480ba4 100644 --- a/lily/include/super-element.hh +++ b/lily/include/super-element.hh @@ -10,25 +10,7 @@ #ifndef Super_element_HH #define Super_element_HH +#error #include "score-element.hh" -/** The toplevel element. The Paper_score contains this element, and any - element shoud be a dependency for the super element. - - It is the entry point for the "constraint solver"/ dependency - tracker. Every XXXX_processing () call traverses the entire - dependency graph, and calls the appropriate - Score_element::do_XXX_processing function on each Score_element it encounters. - - - FIXME: remove this class, to eliminate multiple inheritance. Merge - with Line_of_score ? */ -class Super_element : public virtual Score_element { -public: - void space_processing (); - void pre_processing(); - void breakable_col_processing(); - void post_processing(); - void output_all (); -}; #endif // Super_element_HH diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 478a07289d..89d6de0dd4 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -6,21 +6,23 @@ (c) 1996--2000 Han-Wen Nienhuys */ +#include "axis-group-interface.hh" +#include "debug.hh" #include "line-of-score.hh" +#include "main.hh" +#include "paper-column.hh" #include "paper-def.hh" #include "paper-outputter.hh" -#include "paper-column.hh" #include "paper-score.hh" +#include "string.hh" #include "warn.hh" -#include "main.hh" -#include "debug.hh" -#include "axis-group-interface.hh" Line_of_score::Line_of_score() { set_elt_property ("columns", SCM_EOL); - axis_group (this).set_axes (Y_AXIS,X_AXIS); + Axis_group_interface (this).set_interface (); + Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS); } @@ -67,15 +69,9 @@ Line_of_score::add_column (Paper_column*p) { set_elt_property ("columns", gh_cons (p->self_scm_, get_elt_property ("columns"))); - axis_group (this).add_element (p); + Axis_group_interface (this).add_element (p); } -void -Line_of_score::do_print() const -{ - Spanner::do_print(); - Axis_group_spanner::do_print (); -} void Line_of_score::output_line (bool last_line) @@ -87,7 +83,7 @@ Line_of_score::output_line (bool last_line) translate_axis (- i[MAX], Y_AXIS); pscore_l_->outputter_l_->start_line (i.length ()); - Super_element::output_all (); + output_all (); if (last_line) pscore_l_->outputter_l_->stop_last_line(); else @@ -99,3 +95,67 @@ Line_of_score::compare (Line_of_score* const &p1,Line_of_score* const &p2) { return p1->rank_i_ - p2->rank_i_; } + + + +/** + for administration of what was done already + */ +enum Score_element_status { + ORPHAN=0, // not yet added to pstaff + VIRGIN, // added to pstaff + PREBROKEN, + PREBROKEN_SECOND, + PRECALCING, + PRECALCED, // calcs before spacing done + SPACING, + SPACED, + BROKEN, + BROKEN_SECOND, + POSTCALCING, // busy calculating. This is used to trap cyclic deps. + POSTCALCED, // after spacing calcs done + BREWING, + BREWED, +}; + +void +Line_of_score::pre_processing () +{ + calculate_dependencies (PRECALCED, PRECALCING, &Score_element::before_line_breaking); +} + +void +Line_of_score::space_processing () +{ + calculate_dependencies (SPACED, SPACING, &Score_element::do_space_processing); +} + +/* for break processing, use only one status, because copies have to + have correct status. (Previously, + Score_element::handle_[pre]broken_dependencies assigned to status_i_ + */ +void +Line_of_score::breakable_col_processing () +{ + calculate_dependencies (PREBROKEN, PREBROKEN, &Score_element::do_breakable_col_processing); + // calculate_dependencies (PREBROKEN_SECOND, PREBROKEN_SECOND, &Score_element::handle_prebroken_dependents); +} + + +void +Line_of_score::post_processing () +{ + // calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND, + // &Score_element::handle_broken_dependents); + calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::after_line_breaking); +} + +void +Line_of_score::output_all () +{ + calculate_dependencies (BREWED, BREWING, &Score_element::output_processing); +} + + + + diff --git a/lily/note-column.cc b/lily/note-column.cc index 3b9a26e89b..909629921c 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -42,7 +42,8 @@ Note_column::Note_column() { set_elt_property ("rests", SCM_EOL); set_elt_property ("note-heads", SCM_EOL); - axis_group (this).set_axes (X_AXIS, Y_AXIS); + Axis_group_interface (this).set_interface (); + Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS); } Stem * @@ -92,7 +93,7 @@ Note_column::set_stem (Stem * stem_l) set_elt_property ("stem", stem_l->self_scm_); add_dependency (stem_l); - axis_group (this).add_element (stem_l); + Axis_group_interface (this).add_element (stem_l); } @@ -110,7 +111,7 @@ Note_column::add_head (Rhythmic_head *h) Group_interface gi (this, "note-heads"); gi.add_element (nh); } - axis_group (this).add_element (h); + Axis_group_interface (this).add_element (h); } /** @@ -133,7 +134,7 @@ Note_column::translate_rests (int dy_i) void Note_column::set_dotcol (Dot_column *d) { - axis_group (this).add_element (d); + Axis_group_interface (this).add_element (d); } /* @@ -172,12 +173,12 @@ Note_column::after_line_breaking () beam_y = gh_scm2double (s); - Real x0 = b->first_visible_stem ()->hpos_f (); - Real dx = b->last_visible_stem ()->hpos_f () - x0; + Real x0 = b->first_visible_stem ()->relative_coordinate (0, X_AXIS); + Real dx = b->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0; Real dydx = beam_dy && dx ? beam_dy/dx : 0; Direction d = stem_l ()->get_direction (); - Real beamy = (stem_l ()->hpos_f () - x0) * dydx + beam_y; + Real beamy = (stem_l ()->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y; s = get_elt_property ("rests"); Score_element * se = unsmob_element (gh_car (s));