--- /dev/null
+/*
+ complexstaff.hh -- part of LilyPond
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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<Request*> 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<Command*> &where);
+ virtual void walk();
+
+ Complex_staff();
+};
+
+#endif // COMPLEXSTAF_HH
+
#include "key.hh"
#include "stcol.hh"
#include "staff.hh"
-#include "staffwalker.hh"
struct Lyric_staff;
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);
};
--- /dev/null
+#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<Scalar> 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<Item*> &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<Item*> 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<Item*> 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_);
+}
+
+