--- /dev/null
+/*
+ rhythmstaf.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef MELODICSTAFF_HH
+#define MELODICSTAFF_HH
+
+#include "simplestaff.hh"
+
+/// five line staff, no multiple voices
+struct Melodic_staff : public Simple_staff
+{
+
+ /****************/
+
+ virtual void set_output(PScore *);
+ virtual Melodic_staff*clone()const;
+
+ virtual Stem * get_stem(Stem_req *rq);
+ virtual Notehead * get_notehead(Note_req *rq);
+};
+
+#endif // MELODICSTAFF_HH
+
+
--- /dev/null
+/*
+ rhythmstaf.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef RHYTHMSTAF_HH
+#define RHYTHMSTAF_HH
+
+#include "simplestaff.hh"
+
+/// all notes on one line
+struct Rhythmic_staff : public Simple_staff
+{
+
+ /****************/
+
+ virtual Item *get_TYPESET_item(Command*);
+ virtual Stem *get_stem(Stem_req *rq);
+ virtual Notehead * get_notehead(Note_req *rq);
+ virtual void set_output(PScore *);
+ virtual Rhythmic_staff*clone()const;
+};
+
+#endif // RHYTHMSTAF_HH
+
+
--- /dev/null
+/*
+ simplestaff.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SIMPLESTAFF_HH
+#define SIMPLESTAFF_HH
+
+#include "stcol.hh"
+#include "staff.hh"
+#include "swalker.hh"
+/*
+ mega-stupido staffs and cols: they do notes one at each moment.
+ */
+
+struct Simple_staff;
+
+/// column of Simple_staff: store one request
+struct Simple_column : Staff_column {
+
+ svec<Rhythmic_req *> notes;
+ Stem_req *stem_;
+ Beam_req *beam_;
+ Simple_staff* staff_;
+
+ /****************/
+
+ virtual void typeset_item(Item *, int=1);
+
+ Molecule *create_command_mol(Command *com);
+
+ void take_request(Request *rq);
+ virtual void process_requests();
+
+ Simple_column(Score_column*s,Simple_staff*rs);
+};
+
+
+/// Simple staff: one voicegroup at a time
+struct Simple_staff : Staff {
+ /// indirection to the PStaff.
+ PStaff *theline;
+
+ /****************/
+ Staff_column*create_col(Score_column*);
+
+ virtual Item *get_TYPESET_item(Command*);
+ virtual Stem *get_stem(Stem_req *rq)=0;
+ virtual Notehead *get_notehead(Note_req *rq)=0;
+ virtual Rest *get_rest(Rest_req *rq);
+ virtual void set_output(PScore *);
+
+ void process_commands( PCursor<Command*> &where);
+ virtual void walk();
+
+ Simple_staff();
+};
+
+struct Simple_walker: Staff_walker {
+ Stem *stem_;
+ svec<Notehead *>noteheads;
+ Beam *beam_;
+
+ /****************/
+
+ virtual void process_command(Command*);
+ virtual void process_requests();
+ Simple_walker(Simple_staff*);
+ Simple_column *col();
+ Simple_staff *staff();
+};
+
+
+#endif // SIMPLESTAFF_HH
+
+
+
+
--- /dev/null
+#include "melodicstaff.hh"
+#include "stem.hh"
+#include "rest.hh"
+#include "notehead.hh"
+#include "paper.hh"
+#include "molecule.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "sccol.hh"
+
+const int NO_LINES=5;
+const int BOTTOM_POSITION=2; // e is on bottom line of 5-staff...
+
+void
+Melodic_staff::set_output(PScore*ps)
+{
+ theline = new Linestaff(NO_LINES,ps);
+ Simple_staff::set_output(ps);
+}
+
+
+Notehead*
+Melodic_staff::get_notehead(Note_req *rq)
+{
+ int b = rq->rhythmic()->balltype;
+ int d = rq->rhythmic()->dots;
+
+ Notehead *n =new Notehead((NO_LINES-1)*2);
+ n->balltype =b;
+ n->dots = d;
+ n->position = rq->note()->height() - BOTTOM_POSITION;
+ return n;
+}
+
+
+Stem *
+Melodic_staff::get_stem(Stem_req*rq)
+{
+ Stem * s = new Stem(NO_LINES-1);
+ s->flag = rq->stem_number;
+ return s;
+}
+
+/*
+ creation
+ */
+Staff *
+get_new_melodicstaff()
+{
+ return new Melodic_staff;
+}
+
+
+
+Melodic_staff*
+Melodic_staff::clone()const
+{
+ return new Melodic_staff(*this);
+}
--- /dev/null
+#include "request.hh"
+#include "swalker.hh"
+#include "debug.hh"
+#include "staff.hh"
+#include "command.hh"
+#include "simplestaff.hh"
+#include "sccol.hh"
+
+
+
+
+Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
+ : Staff_column(s)
+{
+ stem_ = 0;
+ staff_ = rs;
+ beam_ = 0;
+}
+
+Simple_staff::Simple_staff()
+{
+ theline = 0;
+}
+
+/**
+ accept:
+
+ BREAK: all
+ TYPESET: bar, meter,
+
+ */
+
+
+
+void
+Simple_column::process_requests()
+{
+ for (int i = 0 ; i < v_elts.sz(); i ++)
+ for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
+ Request *rq= rqc;
+ if (rq->rhythmic()){
+ notes.add( rq->rhythmic());
+ }
+ if (rq->stem()) {
+ stem_ = rq->stem();
+ }
+
+ if (rq->beam()) {
+ beam_ = rq->beam();
+ }
+ }
+}
+Staff_column*
+Simple_staff::create_col(Score_column*s)
+{
+ return new Simple_column(s,this);
+}
+void
+Simple_staff::walk()
+{
+ for (Simple_walker sc(this); sc.ok(); sc++) {
+ sc.col()->process_requests();// TODO
+ sc.process();
+ }
+}
+
--- /dev/null
+#include "request.hh"
+#include "beam.hh"
+#include "pscore.hh"
+#include "simplestaff.hh"
+#include "sccol.hh"
+#include "stem.hh"
+#include "notehead.hh"
+#include "rest.hh"
+#include "debug.hh"
+
+void
+Simple_walker::process_command(Command*com)
+{
+ switch (com->code){
+ case BREAK_PRE:
+ case BREAK_MIDDLE:
+ case BREAK_POST:
+ case BREAK_END:
+ (*this)->score_column->set_breakable();
+ break_status = com->code- BREAK_PRE;
+ break;
+ case INTERPRET:
+ break;
+
+ case TYPESET:
+ {
+ Item* i = staff()->get_TYPESET_item(com);
+ col()->typeset_item(i, break_status);
+ }
+ break;
+
+ default :
+ break;
+ }
+}
+
+void
+Simple_walker::process_requests()
+{
+ Simple_column*c = col();
+ Simple_staff *s = staff();
+ if (c->beam_&& c->beam_->spantype == Span_req::START) {
+ if (beam_)
+ error("Too many beams");
+ beam_ = new Beam;
+ }
+
+ if (c->stem_) {
+ stem_ = s->get_stem(c->stem_->stem());
+ c->typeset_item(stem_);
+ }
+
+ for (int i = 0; i < c->notes.sz(); i ++) {
+ Rhythmic_req*rq = c->notes[i];
+ if (rq->note()) {
+ Notehead*n = s->get_notehead(rq->note());
+ stem_->add(n);
+ noteheads.add(n);
+ }
+
+ if (rq->rest()) {
+ c->typeset_item( s->get_rest(rq->rest()) );
+ }
+ }
+
+
+ if (beam_) {
+ beam_->add(stem_);
+ }
+
+ if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
+ pscore_->typeset_spanner(beam_, s->theline);
+ beam_ = 0;
+ }
+ for (int i = 0; i < noteheads.sz(); i++) {
+ c->typeset_item(noteheads[i]);
+ }
+ noteheads.set_size(0);
+
+ if (stem_) {
+ stem_ = 0;
+ }
+}
+
+Simple_walker::Simple_walker(Simple_staff*s)
+ : Staff_walker(s, s->theline->pscore_)
+{
+ stem_ = 0;
+ beam_ =0;
+}
+
+
+
+Simple_staff*
+Simple_walker::staff()
+{
+ return (Simple_staff*) staff_;
+}
+
+Simple_column*
+Simple_walker::col()
+{
+ return (Simple_column*) *(*this);
+}
+
+