From: fred Date: Fri, 3 Jan 1997 13:40:14 +0000 (+0000) Subject: lilypond-0.0.21 X-Git-Tag: release/1.5.59~6453 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=17d9af37d4f80ec6f678ad66b3a64eced55873e7;p=lilypond.git lilypond-0.0.21 --- diff --git a/hdr/textdef.hh b/hdr/textdef.hh new file mode 100644 index 0000000000..784420c44b --- /dev/null +++ b/hdr/textdef.hh @@ -0,0 +1,24 @@ +/* + textdef.hh -- part of LilyPond + + (c) 1996 Han-Wen Nienhuys +*/ + +#ifndef TEXTDEF_HH +#define TEXTDEF_HH + +#include "string.hh" + +struct Text_def { + int align; + String text; + String style; + + /*****************/ + + Text_def(); + void print()const; + Atom create(Paperdef*)const; +}; +#endif // TEXTDEF_HH + diff --git a/src/script.cc b/src/script.cc new file mode 100644 index 0000000000..493c6823d7 --- /dev/null +++ b/src/script.cc @@ -0,0 +1,95 @@ +#include "request.hh" +#include "paper.hh" +#include "script.hh" +#include "stem.hh" +#include "molecule.hh" +#include "lookup.hh" + +Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_p) +{ + dependencies.add(st_p); + dependencies.add(i); + + staffsize =staflen; + specs = rq->scriptdef; + support= i; + stem_ = st_p; + pos = 0; + symdir=1; + dir =rq->dir; +} + +void +Script::set_symdir() +{ + if (specs->invertsym) + symdir = (dir < 0) ? -1:1; +} + +void +Script::set_default_dir() +{ + if (specs->stemdir) { + if (!stem_) + dir = 1; + else + dir = stem_->dir * specs->stemdir; + } +} + +void +Script::set_default_pos() +{ + assert(dir); + Real y; + Real inter= paper()->internote(); + + int d = specs->staffdir; + if (!d) { + Interval v= support->height(); + pos = rint(v[dir]/inter) + dir* 2; + } else { + y = (d > 0) ? staffsize + 2: -2; // ug + y *=inter; + Interval v= support->height(); + + if (dir > 0) { + y = y >? v.max(); + }else if (dir < 0) { + y = y lookup_->script(specs->symidx).dim.x; +} + +void +Script::do_pre_processing() +{ + set_default_dir(); + set_symdir(); +} + +void +Script::do_post_processing() +{ + set_default_pos(); +} +Molecule* +Script::brew_molecule() const +{ + Paperdef *p =paper(); + + Real dy = p->internote(); + String preidx = (symdir < 0) ?"-" :""; + Symbol ss =p->lookup_->script(preidx+specs->symidx); + Molecule*out = new Molecule(Atom(ss)); + out->translate(Offset(0,dy * pos)); + return + out; +} diff --git a/src/textdef.cc b/src/textdef.cc new file mode 100644 index 0000000000..58c666150c --- /dev/null +++ b/src/textdef.cc @@ -0,0 +1,24 @@ +#include "debug.hh" +#include "lookup.hh" +#include "paper.hh" +#include "molecule.hh" +#include "textdef.hh" + +Text_def::Text_def() +{ + align = 1; // right + style = "roman"; +} + +Atom +Text_def::create(Paperdef*p) const +{ + return p->lookup_->text(style, text, -align); +} + +void +Text_def::print() const +{ + mtor << "Text `" << text << "\', style " << + style << "align " <