From 2228d2c2154fb3043d327f015a962aa6cd53f9ce Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 9 Nov 1996 00:10:04 +0000 Subject: [PATCH] lilypond-0.0.9 --- Sources.make | 19 +++--- objects/Makefile | 2 + src/linestaff.cc | 20 ++++++ src/lookup.cc | 160 +++++++++++++++++++++++++++++++++++++++++++++ src/simpleprint.cc | 55 ++++++++++++++++ 5 files changed, 248 insertions(+), 8 deletions(-) create mode 100644 objects/Makefile create mode 100644 src/linestaff.cc create mode 100644 src/lookup.cc create mode 100644 src/simpleprint.cc diff --git a/Sources.make b/Sources.make index 6e860c07d4..2894394f94 100644 --- a/Sources.make +++ b/Sources.make @@ -2,29 +2,32 @@ # sourcefiles to be shipped. Also for dependencies hdr= qlp.hh linespace.hh qlpsolve.hh\ - pcol.hh proto.hh pstaff.hh line.hh\ + pcol.hh proto.hh pstaff.hh scoreline.hh staffline.hh\ const.hh glob.hh molecule.hh boxes.hh pscore.hh item.hh tex.hh\ request.hh voice.hh command.hh staff.hh linestaff.hh \ tstream.hh rhythmstaff.hh\ parseconstruct.hh debug.hh globvars.hh keyword.hh\ misc.hh score.hh notename.hh lexer.hh symtable.hh\ - symbol.hh main.hh dimen.hh paper.hh lookupsyms.hh\ + symbol.hh main.hh dimen.hh paper.hh lookup.hh\ sccol.hh stcol.hh scommands.hh melodicstaff.hh\ identifier.hh simplestaff.hh spanner.hh stem.hh\ - notehead.hh + notehead.hh leastsquares.hh beam.hh rest.hh\ + swalker.hh bar.hh meter.hh mycc= qlp.cc qlpsolve.cc \ - break.cc linespace.cc molecule.cc line.cc\ - pscore.cc tex.cc item.cc pcol.cc staff.cc rhythmstaff.cc\ - score.cc note.cc main.cc misc.cc \ + break.cc linespace.cc molecule.cc staffline.cc\ + pscore.cc tex.cc item.cc pcol.cc staff.cc \ + rhythmstaff.cc score.cc note.cc main.cc misc.cc\ symbol.cc request.cc notename.cc voice.cc\ keyword.cc linestaff.cc table.cc command.cc\ warn.cc debug.cc symtable.cc boxes.cc\ pstaff.cc tstream.cc\ calcideal.cc scores.cc identifier.cc \ - dimen.cc paper.cc lookupsyms.cc scommands.cc\ + dimen.cc paper.cc lookup.cc scommands.cc\ sccol.cc stcol.cc getcommands.cc simplestaff.cc\ melodicstaff.cc simpleprint.cc stem.cc\ - spanner.cc notehead.cc\ + spanner.cc notehead.cc leastsquares.cc beam.cc\ + texbeam.cc rest.cc swalker.cc scoreline.cc\ + simplewalker.cc bar.cc meter.cc\ template1.cc template2.cc template3.cc\ version.cc \ No newline at end of file diff --git a/objects/Makefile b/objects/Makefile new file mode 100644 index 0000000000..701ad6d5b9 --- /dev/null +++ b/objects/Makefile @@ -0,0 +1,2 @@ +dist: + ln Makefile $(DDIR)/objects/ \ No newline at end of file diff --git a/src/linestaff.cc b/src/linestaff.cc new file mode 100644 index 0000000000..a52954e6f4 --- /dev/null +++ b/src/linestaff.cc @@ -0,0 +1,20 @@ +#include "linestaff.hh" +#include "symbol.hh" +#include "lookup.hh" +#include "dimen.hh" +#include "paper.hh" +#include "pscore.hh" + +Linestaff::Linestaff(int l, PScore *s) + : PStaff(s) +{ + nolines = l; + stafsym = s->paper_->lookup_->linestaff(l); +} + +Symbol +Linestaff::get_stafsym(Real width)const +{ + String w(print_dimen(width)); + return stafsym->eval(w); +} diff --git a/src/lookup.cc b/src/lookup.cc new file mode 100644 index 0000000000..d0ce3cb743 --- /dev/null +++ b/src/lookup.cc @@ -0,0 +1,160 @@ +#include "lookup.hh" +#include "debug.hh" +#include "symtable.hh" +#include "dimen.hh" +#include "tex.hh" + +void +Lookup::parse(Text_db&t) +{ + symtables_->read(t) ; +} + +Lookup::Lookup() +{ + symtables_ = new Symtables; +} + +Lookup::~Lookup() +{ + delete symtables_; +} + +Symbol +Lookup::ball(int j) +{ + if (j > 4) + j = 4; + + Symtable * st = (*symtables_)("balls"); + return st->lookup(String(j)); +} + +Symbol +Lookup::rest(int j) +{ + return (*symtables_)("rests")->lookup(String(j)); +} + + +Symbol +Lookup::bar(String s) +{ + return (*symtables_)("bars")->lookup(s); +} + Symbol +Lookup::dots(int j) +{ + if (j>3) + error("max 3 dots"); + return (*symtables_)("dots")->lookup(j); +} + +Symbol +Lookup::flag(int j) +{ + return (*symtables_)("flags")->lookup(j); +} + +Symbol +Lookup::streepjes(int i) +{ + assert(i); + + int arg; + String idx ; + if (i<0) { + idx = "botlines"; + arg = -i; + }else { + arg = i; + idx = "toplines"; + } + Symbol ret = (*symtables_)("streepjes")->lookup(idx); + + svec a; + a.add(arg); + ret.tex = substitute_args(ret.tex, a); + + return ret; +} + +/****************************************************************/ +// bare bones. + +struct Linestaf_symbol : Parametric_symbol { + int lines; + Linestaf_symbol(int n, Symtables*s): Parametric_symbol(s) { lines = n;} + Symbol eval(svec)const; +}; + + +Symbol +Linestaf_symbol::eval(svec w)const +{ + Real wid = w[0].fvalue(); + + Symbol s; + s.dim.x = Interval(0,wid); + Real dy=(lines-1)*convert_dimen(5,"pt"); // TODO! + s.dim.y = Interval(0,dy); + svec a; + a.add(lines); + a.add(w[0]); + s.tex = (*symtables_)("param")->lookup("linestaf").tex; + s.tex = substitute_args(s.tex, a); + return s; +} + +/****************************************************************/ + + +struct Meter_sym:Parametric_symbol { + + Meter_sym(Symtables*s) : Parametric_symbol(s){ } + Symbol eval(svec a) const{ + Symbol s; + s.dim.x = Interval( convert_dimen(-5,"pt"), + convert_dimen(5,"pt")); + s.dim.y = Interval(0, convert_dimen(10,"pt") ); // todo + String src = (*symtables_)("param")->lookup("meter").tex; + s.tex = substitute_args(src,a); + return s; + } +}; +/****************************************************************/ + +struct Stem_sym:Parametric_symbol { + + Stem_sym(Symtables*s) : Parametric_symbol(s) { } + Symbol eval(svec a) const { + Real y1 = a[0].fvalue(); + Real y2 = a[1].fvalue(); + assert(y1 <= y2); + Symbol s; + s.dim.x = Interval(0,0); + s.dim.y = Interval(y1,y2); + + String src = (*symtables_)("param")->lookup("stem").tex; + s.tex = substitute_args(src,a); + return s; + } +}; + +Parametric_symbol * +Lookup::meter(String ) +{ + return new Meter_sym(symtables_); +} + +Parametric_symbol * +Lookup::linestaff(int n) +{ + return new Linestaf_symbol(n,symtables_); +} + +Parametric_symbol* +Lookup::stem() +{ + return new Stem_sym(symtables_); +} diff --git a/src/simpleprint.cc b/src/simpleprint.cc new file mode 100644 index 0000000000..395396e22b --- /dev/null +++ b/src/simpleprint.cc @@ -0,0 +1,55 @@ +#include "lookup.hh" +#include "request.hh" +#include "beam.hh" +#include "pscore.hh" +#include "paper.hh" +#include "simplestaff.hh" +#include "molecule.hh" +#include "sccol.hh" +#include "stem.hh" +#include "notehead.hh" +#include "rest.hh" +#include "debug.hh" +#include "bar.hh" +#include "meter.hh" + +Item * +Simple_staff::get_TYPESET_item(Command *com) +{ + Item *s; + if (com -> args[0] == "BAR" ) { + s = new Bar(com->args[1]); + } else if (com->args[0] == "METER") { + svec arg( com->args); + arg.del(0); + s = new Meter(arg); + } else + assert(false); + + return s; +} + +void +Simple_column::typeset_item(Item *i, int breakst) +{ + assert(i); + // ugh + staff_->pscore_->typeset_item(i, score_column->pcol, + staff_->theline,breakst); +} + +void +Simple_staff::set_output(PScore* ps ) +{ + pscore_ = ps; + pscore_->add(theline); +} + + +Rest* +Simple_staff::get_rest(Rest_req*rq) +{ + int b = rq->rhythmic()->balltype; + int d = rq->rhythmic()->dots; + return new Rest(b, d); +} -- 2.39.5