From 5a5d6df5de28c690a3f0d21eeccf31587babe2f6 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 8 Jan 1997 11:29:43 +0000 Subject: [PATCH] lilypond-0.0.22 --- src/script.cc | 63 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/src/script.cc b/src/script.cc index 493c6823d7..4f5ed1c0e7 100644 --- a/src/script.cc +++ b/src/script.cc @@ -5,15 +5,15 @@ #include "molecule.hh" #include "lookup.hh" -Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_p) +Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_l) { - dependencies.add(st_p); + dependencies.add(st_l); dependencies.add(i); staffsize =staflen; - specs = rq->scriptdef; + specs_l_ = rq->scriptdef; support= i; - stem_ = st_p; + stem_l_ = st_l; pos = 0; symdir=1; dir =rq->dir; @@ -22,42 +22,51 @@ Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_p) void Script::set_symdir() { - if (specs->invertsym) + if (specs_l_->invertsym) symdir = (dir < 0) ? -1:1; } void Script::set_default_dir() { - if (specs->stemdir) { - if (!stem_) + if (specs_l_->stemdir) { + if (!stem_l_) dir = 1; else - dir = stem_->dir * specs->stemdir; + dir = stem_l_->dir * specs_l_->stemdir; } } void Script::set_default_pos() { - assert(dir); - Real y; Real inter= paper()->internote(); - - int d = specs->staffdir; + Interval dy = symbol().dim.y; + + int d = specs_l_->staffdir; if (!d) { Interval v= support->height(); - pos = rint(v[dir]/inter) + dir* 2; + pos = rint((v[dir] -dy[-dir])/inter) + dir* 2; } else { - y = (d > 0) ? staffsize + 2: -2; // ug + Real y = (d > 0) ? staffsize + 2: -2; // ug y *=inter; Interval v= support->height(); - if (dir > 0) { + if (d > 0) { y = y >? v.max(); - }else if (dir < 0) { + } else if (d < 0) { y = y height(); + + if (d > 0) { + y = y >? v.max(); + }else if (d < 0) { + y = y lookup_->script(specs->symidx).dim.x; + return symbol().dim.x; +} + +Symbol +Script::symbol()const +{ + String preidx = (symdir < 0) ?"-" :""; + return paper()->lookup_p_->script(preidx+specs_l_->symidx); } void @@ -80,16 +96,13 @@ 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)); + Real dy = paper()->internote(); + + Molecule*out = new Molecule(Atom(symbol())); out->translate(Offset(0,dy * pos)); - return - out; + return out; } -- 2.39.5