From d5ef70f4a097662b5e18acfc868299af46df982a Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:44:30 +0000 Subject: [PATCH] lilypond-0.0.65 --- lily/include/spanner-elem-group.hh | 25 +++++++ lily/include/staffline.hh | 25 +++---- lily/staffline.cc | 111 ++--------------------------- 3 files changed, 39 insertions(+), 122 deletions(-) create mode 100644 lily/include/spanner-elem-group.hh diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh new file mode 100644 index 0000000000..a23819ac6d --- /dev/null +++ b/lily/include/spanner-elem-group.hh @@ -0,0 +1,25 @@ +/* + spanner-elem-group.hh -- declare Spanner_elem_group + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SPANNER_ELEM_GROUP_HH +#define SPANNER_ELEM_GROUP_HH + +#include "spanner.hh" +#include "elem-group.hh" + +class Spanner_elem_group : public Spanner, public Element_group { + +protected: + void do_break_at(PCol*,PCol*); + virtual Interval do_width()const; + virtual void do_print() const; + SPANNER_CLONE(Spanner_elem_group) + NAME_MEMBERS(Spanner_elem_group); +}; +#endif // SPANNER_ELEM_GROUP_HH diff --git a/lily/include/staffline.hh b/lily/include/staffline.hh index 107d360c79..f059a1418f 100644 --- a/lily/include/staffline.hh +++ b/lily/include/staffline.hh @@ -1,5 +1,5 @@ /* - staffline.hh -- horizontal structures for broken scores. + staffline.hh -- horizontal structures for broken scores. (c) 1996,97 Han-Wen Nienhuys */ @@ -7,25 +7,20 @@ #ifndef STAFFLINE_HH #define STAFFLINE_HH -#include "proto.hh" -#include "real.hh" -#include "plist.hh" -#include "varray.hh" -#include "glob.hh" -#include "p-staff.hh" +#include "spanner-elem-group.hh" /// one broken line of staff. -struct Line_of_staff { +struct Line_of_staff : public Spanner_elem_group{ - Line_of_score * line_of_score_l_; - PStaff *pstaff_l_; + SPANNER_CLONE(Line_of_staff) +public: + NAME_MEMBERS(Line_of_staff); /* *************** */ - - String TeXstring() const; - Line_of_staff(Line_of_score*, PStaff *); - Interval height() const; - void process(); + /** + Add an element. If it is a Element_group, only the dependency + (otherwise, might translate doubly) */ + void add_element(Score_elem*); }; #endif diff --git a/lily/staffline.cc b/lily/staffline.cc index c4d4861b8c..533d512645 100644 --- a/lily/staffline.cc +++ b/lily/staffline.cc @@ -8,115 +8,12 @@ #include "p-col.hh" #include "p-score.hh" -static String -make_vbox(Interval i) -{ - if (i.empty_b()) - i = Interval(0,0); - Real r = i.length(); - String s("\\vbox to "); - s += print_dimen(r); - s += "{\\vskip "+print_dimen(i.right)+" "; - return s; -} - - -String -Line_of_staff::TeXstring() const -{ - String s("%line_of_staff\n"); - - s+=make_vbox(height()); - // the staff itself: eg lines, accolades - s += "\\hbox{"; - { - iter_top(line_of_score_l_->cols,cc); - Real lastpos=cc->hpos; - - // all items in the current line & staff. - for (; cc.ok(); cc++) { - String chunk_str; - - Real delta = cc->hpos - lastpos; - - - if (cc->error_mark_b_) { - chunk_str += String("\\columnerrormark"); - } - // now output the items. - for (iter_top(cc->its,i); i.ok(); i++) { - if (i->pstaff_l_ == pstaff_l_) - chunk_str += i->TeXstring(); - } - // spanners. - for (iter_top(cc->starters,i); i.ok(); i++) - if (i->pstaff_l_ == pstaff_l_) - chunk_str += i->TeXstring(); - - if (chunk_str!="") { - // moveover - if (delta) - s +=String( "\\kern ") + print_dimen(delta); - s += chunk_str; - lastpos = cc->hpos; - } - } - } - s+="\\hss}\\vss}"; - return s; -} - -Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st) -{ - line_of_score_l_=sc; - pstaff_l_=st; - - PCol *linestart = sc->cols.top(); - PCol *linestop = sc->cols.bottom(); - - for (iter_top(pstaff_l_->spans,i); i.ok(); i++) { - PCol *brokenstart = &max(*linestart, *i->left_col_l_); - PCol *brokenstop = &min(*linestop, *i->right_col_l_); - if ( *brokenstart < *brokenstop) { - Spanner*span_p =i->broken_at(brokenstart,brokenstop); - line_of_score_l_->pscore_l_-> // higghl - add_broken(span_p); - } - } -} - - -Interval -Line_of_staff::height() const -{ - Interval y(0,0); - - iter_top(line_of_score_l_->cols,cc); - - // all items in the current line & staff. - for (; cc.ok(); cc++) { - for (iter_top(cc->its,i); i.ok(); i++) { - if (i->pstaff_l_ == pstaff_l_) - y.unite(i->height()); - - } - // spanners. - for (iter_top(cc->starters,i); i.ok(); i++) - if (i->pstaff_l_ == pstaff_l_) { - y.unite(i->height()); - } - } - - return y; -} +IMPLEMENT_STATIC_NAME(Line_of_staff); void -Line_of_staff::process() +Line_of_staff::add_element(Score_elem*elem_l) { -#if 0 - if (!pstaff_l_->stafsym_p_) - pstaff_l_->brew_molecule_p(line_of_score_l_->pscore_l_-> - paper_l_->linewidth); -#endif + if (!elem_l->group_element_i_) + Element_group::add_element(elem_l); } -- 2.39.5