From a24ce92be66921d36050efcbdadafb1e81279830 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:28:54 +0000 Subject: [PATCH] lilypond-0.0.26 --- hdr/complexstaff.hh | 53 ++++++++++++++++++++++++ hdr/lyriccolumn.hh | 8 +--- src/complexprint.cc | 98 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 7 deletions(-) create mode 100644 hdr/complexstaff.hh create mode 100644 src/complexprint.cc diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh new file mode 100644 index 0000000000..4413add60e --- /dev/null +++ b/hdr/complexstaff.hh @@ -0,0 +1,53 @@ +/* + complexstaff.hh -- part of LilyPond + + (c) 1996,1997 Han-Wen Nienhuys +*/ + +#ifndef COMPLEXSTAF_HH +#define COMPLEXSTAF_HH + + +#include "key.hh" +#include "stcol.hh" +#include "staff.hh" +#include "staffwalker.hh" + +/// column of Complex_staff: store one request +struct Complex_column : Staff_column { + + Array todo_l_arr_; + Complex_staff* staff_l_; + + /****************/ + + Slur_req *find_slur(Voice *); + + void typeset_item(Item *, int=1); + void typeset_item_directional(Item *, int dir, int=1); + Molecule *create_command_mol(Command *com); + + void take_request(Request *rq); + virtual void setup_requests(); + + Complex_column(Score_column*s,Complex_staff*rs); +}; + + +/// Complex staff: one voicegroup at a time +struct Complex_staff : Staff { + /// indirection to the PStaff. + PStaff *theline_l_; + + /****************/ + Staff_column*create_col(Score_column*); + virtual Item *get_TYPESET_item(Command*); + virtual void set_output(PScore *); + void process_commands( PCursor &where); + virtual void walk(); + + Complex_staff(); +}; + +#endif // COMPLEXSTAF_HH + diff --git a/hdr/lyriccolumn.hh b/hdr/lyriccolumn.hh index 368dadf1bc..145ff7fc08 100644 --- a/hdr/lyriccolumn.hh +++ b/hdr/lyriccolumn.hh @@ -10,7 +10,6 @@ #include "key.hh" #include "stcol.hh" #include "staff.hh" -#include "staffwalker.hh" struct Lyric_staff; @@ -28,12 +27,7 @@ struct Lyric_column : Staff_column { Lyric_staff* lstaff_l_; void typeset_item(Item *, int=1); -// void typeset_item_directional(Item *, int dir, int=1); - -// Molecule *create_command_mol(Command *com); - -// void take_request(Request *rq); - virtual void process_requests(); + virtual void setup_requests(); Lyric_column(Score_column*s,Lyric_staff*rs); }; diff --git a/src/complexprint.cc b/src/complexprint.cc new file mode 100644 index 0000000000..f266f7bed7 --- /dev/null +++ b/src/complexprint.cc @@ -0,0 +1,98 @@ +#include "request.hh" +#include "pscore.hh" +#include "paper.hh" +#include "complexstaff.hh" +#include "sccol.hh" +#include "debug.hh" + +#include "clefitem.hh" +#include "bar.hh" +#include "meter.hh" + +Item * +Complex_staff::get_TYPESET_item(Command *com) +{ + Item *s=0; + Array arg( com->args); + String type =arg[0]; + arg.del(0); + if (type == "BAR" ) { + s = new Bar(com->args[1]); + } else if (type == "METER") { + s = new Meter(arg); + } else if (type == "CLEF" || type == "CURRENTCLEF") { + Clef_item * c = new Clef_item; + s = c; + c->change = (type == "CLEF"); + }else{ + WARN << "ignoring TYPESET command for " << type << '\n'; + } + return s; +} + + +Interval +citemlist_width(const Array &its) +{ + Interval iv ; + iv.set_empty(); + + for (int j =0; j < its.size(); j++){ + iv.unite (its[j]->width()); + + } + return iv; +} + +void +Complex_column::typeset_item(Item *i, int breakst) +{ + assert(i); + + staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, + staff_l_->theline_l_,breakst); + + if (breakst == BREAK_PRE - BREAK_PRE) { + + Array to_move( + staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + score_column_l_->pcol_l_->prebreak_p_)); + Interval column_wid = citemlist_width(to_move); + assert(!column_wid.empty()); + + for (int j=0; j < to_move.size(); j++) { + to_move[j]->translate(Offset(-column_wid.right, 0)); + } + } +} +/* + UGGGG + */ +void +Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH! +{ + assert(i); + PCol * c=score_column_l_->pcol_l_; + if (breakst == 0) + c = c->prebreak_p_; + else if (breakst == 2) + c = c->postbreak_p_; + + Array to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + c)); + typeset_item(i, breakst); + + Interval column_wid = citemlist_width(to_move); + if (column_wid.empty()) + column_wid = Interval(0,0); + i->translate(Offset(column_wid[dir] - i->width()[-dir], 0)); +} + +void +Complex_staff::set_output(PScore* ps ) +{ + pscore_l_ = ps; + pscore_l_->add(theline_l_); +} + + -- 2.39.5