]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.6
authorfred <fred>
Sat, 2 Nov 1996 01:47:00 +0000 (01:47 +0000)
committerfred <fred>
Sat, 2 Nov 1996 01:47:00 +0000 (01:47 +0000)
melodicstaff.hh [new file with mode: 0644]
simpleprint.cc [new file with mode: 0644]

diff --git a/melodicstaff.hh b/melodicstaff.hh
new file mode 100644 (file)
index 0000000..a91a413
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  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
+{
+    Staff_column * create_col(Score_column*);
+    virtual void set_output(PScore *);
+    virtual Melodic_staff*clone()const;
+};
+
+struct Melodic_column : public Simple_column {
+    virtual void typeset_req(Request *rq);
+  virtual void typeset_command(Command *, int brs);
+  //    virtual void typeset_item(Item*, int=1);
+    Melodic_column(Score_column*s,Simple_staff*rs) :
+       Simple_column(s,rs) { }
+//    virtual Melodic_column*clone()const;
+};
+
+#endif // MELODICSTAFF_HH
+
+
diff --git a/simpleprint.cc b/simpleprint.cc
new file mode 100644 (file)
index 0000000..91b7761
--- /dev/null
@@ -0,0 +1,79 @@
+#include "lookupsyms.hh"
+#include "request.hh"
+#include "pscore.hh"
+#include "paper.hh"
+#include "simplestaff.hh"
+#include "molecule.hh"
+#include "sccol.hh"
+
+Item *
+Simple_column::create_req_item(Request *rq)
+{
+    Item *i = new Item;
+    Symbol s;
+    int dots=0;
+
+    if (rq->note())
+       s = staff_->paper()->lookup_->ball(rq->note()->balltype);
+    else if (rq->rest())
+       s = staff_->paper()->lookup_->rest(rq->rest()->balltype);
+
+    if (rq->rhythmic())
+       dots=rq->rhythmic()->dots;
+
+
+    Molecule *m = new Molecule(Atom(s));
+    if (dots) {
+       Symbol d = staff_->paper()->lookup_->dots(dots);
+       Molecule dm;
+       dm.add(Atom(d));
+       m->add_right(dm);
+    }
+    i->output=m;
+    return i;
+}
+Item *
+Simple_column::create_command_item(Command *com)
+{
+    Item *i = new Item;
+    Symbol s;
+
+    if (com -> args[0] ==  "BAR" ) {
+       s = staff_->paper()->lookup_->bar(com->args[1]);        
+    } else if (com->args[0] == "METER") {
+       Parametric_symbol *p = staff_->paper()->lookup_->meter("general");
+       svec<String> arg( com->args);
+       arg.del(0);
+       s = p->eval(arg);
+    } else
+       assert(false);
+
+    Molecule * m =new Molecule(Atom(s));
+    {
+       Interval wid;
+       svec<Item*> sv(staff_->pscore_->
+                      select_items(staff_->theline, score_column->pcol));
+       for (int j=0; j<sv.sz(); j++) {
+           wid.unite(sv[j]->output->extent().x);
+       }
+       if (!wid.empty())
+           m->translate(Offset(wid.max,0));
+    }
+    i->output=m;
+    return i;
+}
+
+void
+Simple_column::typeset_item(Item *i, int breakst)
+{
+    // ugh
+    staff_->pscore_->typeset_item(i, score_column->pcol,
+                                 staff_->theline,breakst);
+}
+
+void
+Simple_staff::set_output(PScore* ps )
+{
+    pscore_ = ps;
+    pscore_->add(theline);
+}