#!/bin/sh
+PREFIX=${PREFIX:-.}
+echo using PREFIX=$PREFIX
-NEEDFLOWERVER=1.0.21
+NEEDFLOWERVER=1.0.22
flowertar=flower-$NEEDFLOWERVER
here=`pwd`
-if [ -x ../flower ]
+cd ..
+if [ -x flower ]
then
echo Found flowerdir
else
- cd ../
- if [ ! -f $flowertar ]
+
+ if [ ! -d $flowertar ]
then
echo "can't find $flowertar"
exit 1;
fi
echo Compiling Library
-cd flower; make
+(cd flower;make)
+
cd $here
-PREFIX="."
echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh
-touch depend
make -f Initial.make
%
%
-
-
-ritme = staff {rhythmic
+ritme = staff {
+ rhythmic
music {$
c8
|[a8() a8. a8 a16 a16 a16] c4.
melody=
staff { melodic
+% complex
music{$
c8
|r4 r4 r4 r4
skip 2:0
key
skip 5:0
- clef "bass"
+ clef bass
}
}
Array<PCol *> retval;
for (iter_top(pscore_.cols,c); c.ok(); c++)
if (c->breakable())
- retval.add(c);
+ retval.push(c);
return retval;
}
void
Col_configuration::add( PCol*c)
{
- cols.add(c);
+ cols.push(c);
}
void
--- /dev/null
+#include "request.hh"
+#include "voice.hh"
+#include "staffwalker.hh"
+#include "debug.hh"
+#include "clef.hh"
+#include "staff.hh"
+#include "command.hh"
+#include "complexstaff.hh"
+#include "sccol.hh"
+#include "complexwalker.hh"
+
+
+
+Complex_column::Complex_column(Score_column*s, Complex_staff *rs)
+ : Staff_column(s)
+{
+ staff_l_ = rs;
+}
+
+Complex_staff::Complex_staff()
+{
+ theline_l_ = 0;
+}
+
+void
+Complex_column::setup_requests()
+{
+ for (int i = 0 ; i < v_elts.size(); i ++)
+ for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
+
+ if (j->barcheck()) {
+ if (tdescription_->whole_in_measure) {
+ error("Barcheck failed, " + tdescription_->str());
+ }
+ continue;
+ }
+ if (j->mark())
+ continue;
+ if (j->command())
+ continue;
+ todo_l_arr_.push(j);
+ }
+}
+
+Staff_column*
+Complex_staff::create_col(Score_column*s)
+{
+ return new Complex_column(s,this);
+}
+
+void
+Complex_staff::walk()
+{
+ for (Complex_walker sc(this); sc.ok(); sc++) {
+ sc.col()->setup_requests();// TODO
+ sc.process();
+ }
+}
--- /dev/null
+#include "associter.hh"
+#include "script.hh"
+#include "request.hh"
+#include "voice.hh"
+#include "clef.hh"
+#include "pscore.hh"
+#include "complexstaff.hh"
+#include "complexwalker.hh"
+#include "sccol.hh"
+#include "debug.hh"
+#include "keyitem.hh"
+#include "clefitem.hh"
+#include "voicegroup.hh"
+#include "register.hh"
+
+Rhythmic_grouping
+cparse_grouping(Array<Scalar> a, Moment one_beat)
+{
+ Array<int> r;
+ for (int i= 0 ; i < a.size(); i++)
+ r.push(a[i]);
+ Moment here =0.0;
+
+ Array<Rhythmic_grouping*> children;
+ for (int i=0; i < r.size(); i++) {
+
+ Moment last = here;
+ here += one_beat * r[i];
+ children.push(
+ new Rhythmic_grouping(MInterval(last, here), r[i] )
+ );
+ }
+ return Rhythmic_grouping(children);
+}
+
+void
+Complex_walker::do_INTERPRET_command(Command*com)
+{
+ Array<Scalar> args(com->args);
+ args.del(0);
+ if (com->args[0] == "GROUPING") {
+ default_grouping = cparse_grouping(args,
+ col()->tdescription_->one_beat);
+ }else if (com->args[0] == "NEWMEASURE") {
+ local_key_.reset(key_);
+
+ } else if (com->args[0] == "KEY") {
+
+ if (col()->when() > Moment(0)) {
+ assert(!oldkey_undo);
+ oldkey_undo = new Array<int>( key_.oldkey_undo(args));
+ }
+
+ typesetkey = key_.read(args);
+ local_key_.reset(key_);
+ } else if (com->args[0] == "CLEF") {
+ clef_.read(args);
+ } else {
+ WARN << " ignoring INTERPRET command: " << com->args[0]<< "\n";
+ }
+}
+
+void
+Complex_walker::do_TYPESET_command(Command*com)
+{
+ /* ignore these commands if non-default versions have been
+ processed. */
+ if (com->args[0] == "CURRENTKEY")
+ if (processed_key)
+ return;
+ else
+ com->args[0] = "KEY"; // urgh
+
+ if (com->args[0] == "CURRENTCLEF") {
+ if (processed_clef)
+ return;
+ }
+ if (com->args[0] == "BAR") {
+
+ if (processed_bar_priority > com->priority)
+ return;
+ else
+ processed_bar_priority = com->priority;
+ }
+
+ Item* i = staff()->get_TYPESET_item(com);
+ if (!i)
+ return;
+
+ if (com->args[0] == "KEY") {
+ ((Keyitem*) i)->read(clef_);
+ if (oldkey_undo) {
+ ((Keyitem*) i)->read(*oldkey_undo);
+ delete oldkey_undo;
+ oldkey_undo = 0;
+ }
+ processed_key = true;
+
+ ((Keyitem*) i)->read(typesetkey); // ugh
+ }
+
+ if (com->args[0] == "CLEF"||com->args[0] == "CURRENTCLEF") {
+ processed_clef =true;
+ Clef_item*c=(Clef_item*)i;
+ c->read(clef_);
+ c->change = (break_status != BREAK_POST - BREAK_PRE);
+ }
+ col()->typeset_item_directional(i, 1, break_status);
+}
+
+void
+Complex_walker::announce_element(Staff_elem_info info)
+{
+ announce_info_arr_.push(info);
+}
+
+void
+Complex_walker::do_announces()
+{
+
+ for (int i = 0; i < announce_info_arr_.size(); i++){
+ Staff_elem_info info = announce_info_arr_[i];
+ for (iter_top(voice_reg_list_,j); j.ok(); j++) {
+ j->announce_element(info);
+ }
+ group_regs_.announce_element(info);
+ local_key_reg_.acknowledge_element(info);
+ }
+}
+
+Voice_registers *
+Complex_walker::find_voice_reg(Voice*v_l)
+{
+ for (iter_top(voice_reg_list_, i); i.ok(); i++) {
+ if (i->voice_l_ == v_l)
+ return i;
+ }
+
+ Voice_registers *regs_p=new Voice_registers(this,v_l);
+ voice_reg_list_.bottom().add (regs_p);
+ //voice_reg_map_[v_l] = regs_p;
+ return regs_p;
+}
+
+void
+Complex_walker::try_request(Request*req)
+{
+ bool b;
+ if (req->note() || req->rest()|| req->slur()) {
+ Voice *v_l = req->elt_l_->voice_l_;
+ Voice_registers *vregs_l = find_voice_reg(v_l);
+
+ b = vregs_l->try_request(req);
+
+ } else {
+ b = group_regs_.try_request(req);
+ if (!b)
+ b = local_key_reg_.try_request(req);
+ }
+ if (!b)
+ WARN<< "junking request: " <<req->name() <<"\n";
+}
+
+void
+Complex_walker::process_requests()
+{
+ Complex_column*c = col();
+// Complex_staff *s = staff();
+
+ for (int i=0; i < c->todo_l_arr_.size(); i++) {
+ try_request(c->todo_l_arr_[i]);
+ }
+
+ regs_process_requests();
+ do_announces();
+}
+
+void
+Complex_walker::regs_process_requests()
+{
+ for (iter_top(voice_reg_list_,j); j.ok(); j++) {
+ j->process_requests();
+ }
+ group_regs_.process_requests();
+ local_key_reg_.process_request();
+}
+
+void
+Complex_walker::typeset_element(Staff_elem *elem_p)
+{
+ if (elem_p->spanner())
+ pscore_l_->typeset_spanner(elem_p->spanner(), staff()->theline_l_);
+ else
+ col()->typeset_item(elem_p->item());
+}
+
+Complex_walker::Complex_walker(Complex_staff*s)
+ : Staff_walker(s, s->theline_l_->pscore_l_),
+ group_regs_(this),
+ local_key_reg_(this)
+{
+ oldkey_undo = 0;
+ do_post_move();
+}
+
+Complex_staff*
+Complex_walker::staff()
+{
+ return (Complex_staff*) staff_l_;
+}
+
+Complex_column*
+Complex_walker::col()
+{
+ return (Complex_column*) *(*this);
+}
+
+void
+Complex_walker::do_pre_move()
+{
+ for (iter_top(voice_reg_list_,i); i.ok(); i++) {
+ i->pre_move_processing();
+ }
+ group_regs_.pre_move_processing();
+ local_key_reg_.pre_move_processing();
+}
+
+void
+Complex_walker::do_post_move()
+{
+ processed_clef =false;
+ processed_key = false;
+ processed_bar_priority = 0;
+
+ for (iter_top(voice_reg_list_,i); i.ok(); i++) {
+ i->post_move_processing();
+ }
+ announce_info_arr_.set_size(0);
+ group_regs_.post_move_processing();
+ local_key_reg_.post_move_processing();
+}
Command*c = new Command;
c->code = TYPESET;
- c->args.add( "METER");
- c->args.add( n );
- c->args.add( m );
+ c->args.push( "METER");
+ c->args.push( n );
+ c->args.push( m );
c->priority = 40;
return c;
}
{
Command c;
c.code = TYPESET;
- c.args.add("BAR");
- c.args.add("default");
+ c.args.push("BAR");
+ c.args.push("default");
return c;
}
Command c;
c.code = TYPESET;
c.priority = (s=="default") ? 100: 110;
- c.args.add("BAR");
+ c.args.push("BAR");
if(s=="default")
s = "|";
if (s == ":|:") {
no_break_com=post_com=pre_com = c;
- pre_com.args.add( ":|");
- no_break_com.args.add( s);
- post_com.args.add( "|:");
+ pre_com.args.push( ":|");
+ no_break_com.args.push( s);
+ post_com.args.push( "|:");
}else if (s=="|:") {
- c.args.add(s);
+ c.args.push(s);
no_break_com=post_com=c;
} else {
- c.args.add(s);
+ c.args.push(s);
pre_com= no_break_com= c;
}
}
MInterval i(interval());
MInterval r1(i), r2(i);
r1.right = r2.left = i.center();
- r.add(r1); r.add(r2);
+ r.push(r1); r.push(r2);
} else {
for (int i=0; i < children.size(); i++)
- r.add(children[i]->interval());
+ r.push(children[i]->interval());
}
return r;
}
} else {
if (i == starti) {
- ch.add(children[i]);
+ ch.push(children[i]);
} else {
Rhythmic_grouping *newchild=new Rhythmic_grouping(
children.subvec(starti, i+1));
- ch.add(newchild);
+ ch.push(newchild);
}
i ++;
j++;
Moment dt = t.length()/n;
MInterval basic = MInterval(t.left, t.left+dt);
for (int i= 0; i < n; i++)
- children.add(new Rhythmic_grouping( dt*i + basic ));
+ children.push(new Rhythmic_grouping( dt*i + basic ));
}
{
interval_ = (s.interval_)? new MInterval(*s.interval_) : 0;
for (int i=0; i < s.children.size(); i++)
- children.add(new Rhythmic_grouping(*s.children[i]));
+ children.push(new Rhythmic_grouping(*s.children[i]));
}
void
#endif
}
+bool
+Rhythmic_grouping::child_fit_query(Moment start)
+{
+ if (children.size())
+ return ( children.last()->interval().right== start);
+
+ return true;
+}
+
void
Rhythmic_grouping::add_child(Moment start, Moment len)
{
Moment stop = start+len;
- for (int i=0; i < children.size(); i ++) {
- MInterval j=children[i]->interval();
- if (j.left == start && j.right==stop) {
- return;
- }
- }
-
- if (children.size())
- assert ( children.last()->interval().right== start);
- children.add(new Rhythmic_grouping(MInterval(start, stop)));
+ assert(child_fit_query(start));
+ children.push(new Rhythmic_grouping(MInterval(start, stop)));
}
Rhythmic_grouping::Rhythmic_grouping()
Array<int> child_beams;
if (children[i]->interval_) {
int f = flags[flagidx++];
- child_beams.add(f);
+ child_beams.push(f);
} else {
child_beams = children[i]->
generate_beams(flags, flagidx);
}
- children_beams.add(child_beams);
+ children_beams.push(child_beams);
}
Array<int> beams;
int lastm, m, nextm;
if (children_beams[i].size() == 1) {
if (add_right)
- beams.add(m);
+ beams.push(m);
if (add_left)
- beams.add(m);
+ beams.push(m);
} else {
if (add_left)
- beams.add(lastm <? m);
+ beams.push(lastm <? m);
beams.concat(children_beams[i]);
if (add_right)
- beams.add(m <? nextm);
+ beams.push(m <? nextm);
}
lastm = m;
m = nextm;
get_partial_command(Moment u)
{
Input_command*c = new Input_command;
- c->args.add("PARTIAL");
- c->args.add(u);
+ c->args.push("PARTIAL");
+ c->args.push(u);
return c;
}
get_goto_command(String s)
{
Input_command*c = new Input_command;
- c->args.add("GOTO");
- c->args.add(s);
+ c->args.push("GOTO");
+ c->args.push(s);
return c;
}
{
Input_command*c = new Input_command;
- c->args.add("CADENZA");
- c->args.add(i);
+ c->args.push("CADENZA");
+ c->args.push(i);
return c;
}
Input_command*
get_grouping_command(Array<int>a )
{
Input_command*c = new Input_command;
- c->args.add("GROUPING");
+ c->args.push("GROUPING");
for (int i=0; i < a.size(); i ++)
- c->args.add(a[i]);
+ c->args.push(a[i]);
return c;
}
get_key_interpret_command(Array<int >a )
{
Input_command*c = new Input_command;
- c->args.add("KEY");
+ c->args.push("KEY");
for (int i=0; i < a.size(); i ++) {
- c->args.add(a[i]);
+ c->args.push(a[i]);
}
return c;
}
get_reset_command()
{
Input_command*c = new Input_command;
- c->args.add("RESET");
+ c->args.push("RESET");
return c;
}
{
Input_command*c = new Input_command;
- c->args.add( "METER");
- c->args.add( n );
- c->args.add( m );
+ c->args.push( "METER");
+ c->args.push( n );
+ c->args.push( m );
return c;
}
get_newmeasure_command()
{
Input_command*c = new Input_command;
- c->args.add( "NEWMEASURE");
+ c->args.push( "NEWMEASURE");
return c;
}
{
Input_command*c = new Input_command;
- c->args.add( "SKIP");
- c->args.add( n );
- c->args.add( m );
+ c->args.push( "SKIP");
+ c->args.push( n );
+ c->args.push( m );
return c;
}
get_clef_interpret_command(String w)
{
Input_command*c = new Input_command;
- c->args.add("CLEF");
- c->args.add(w);
+ c->args.push("CLEF");
+ c->args.push(w);
return c;
}
get_bar_command(String w)
{
Input_command*c = new Input_command;
- c->args.add("BAR");
- c->args.add(w);
+ c->args.push("BAR");
+ c->args.push(w);
return c;
}
Array<int> s;
if (!(count % 3 )) {
for (int i=0; i < count/3; i++)
- s.add(3);
+ s.push(3);
} else if (!(count %2)) {
for (int i=0; i < count/2; i++)
- s.add(2);
+ s.push(2);
}else {
- s.add(2);
+ s.push(2);
s.concat(get_default_grouping(count-2));
}
return s;
Array<Staff*> parsed_staffs;
for (iter_top(staffs_,i); i.ok(); i++) {
Staff* staf_p=i->parse(s_p);
- parsed_staffs.add(staf_p);
+ parsed_staffs.push(staf_p);
s_p->add(staf_p);
}
int j = 0;
int small = s[i++];
accidentals[large]=small;
- newkey.add(large);
- newkey.add(small);
+ newkey.push(large);
+ newkey.push(small);
}
return newkey;
}
}
for (int i=0; i < newkey.size(); i++)
if (accidentals[i] && accidentals[i] != newkey[i]) {
- oldkey.add(i);
- oldkey.add(0);
+ oldkey.push(i);
+ oldkey.push(0);
}
const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */
-
+NAME_METHOD(Keyitem);
Keyitem::Keyitem(int c)
{
c_position = c;
(a>0 && p>SHARP_TOP_PITCH)) {
p=p-7; /* Typeset below c_position */
}
- pitch.add(p);
- acc.add(a);
+ pitch.push(p);
+ acc.push(a);
}
{
Array<String> a;
- a.add(text);
+ a.push(text);
Symbol tsym = (*symtables_)("style")->lookup(style);
a[0] = substitute_args(tsym.tex,a);
Symbol ret = (*symtables_)("streepjes")->lookup(idx);
Array<String> a;
- a.add(arg);
+ a.push(arg);
ret.tex = substitute_args(ret.tex, a);
return ret;
s.dim.y = Interval(0,dy);
Array<String> a;
- a.add(lines);
- a.add(print_dimen(wid));
+ a.push(lines);
+ a.push(print_dimen(wid));
s.tex = (*symtables_)("param")->lookup("linestaf").tex;
s.tex = substitute_args(s.tex, a);
s.dim.y = Interval(y1,y2);
Array<String> a;
- a.add(print_dimen(y1));
- a.add(print_dimen(y2));
+ a.push(print_dimen(y1));
+ a.push(print_dimen(y2));
String src = (*symtables_)("param")->lookup("stem").tex;
s.tex = substitute_args(src,a);
#include "staffwalker.hh"
#include "debug.hh"
#include "staff.hh"
-#include "command.hh"
-//#include "simplestaff.hh"
+//#include "command.hh"
#include "lyricstaff.hh"
#include "lyriccolumn.hh"
#include "sccol.hh"
-//#include "simplewalker.hh"
#include "pscore.hh"
-#include "paper.hh"
+//#include "paper.hh"
Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l)
}
void
-Lyric_column::process_requests()
+Lyric_column::setup_requests()
{
for (int i = 0 ; i < v_elts.size(); i ++) {
for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
error("Barcheck failed, " + tdescription_->str());
}
}
-#if 0
- if (req_l->rhythmic()){
- notes.add(rq->rhythmic());
- }
-#endif
if (req_l->lreq_l()) {
- winfo_array_.add(req_l->lreq_l());
+ winfo_array_.push(req_l->lreq_l());
}
}
}
// whugh.. Hard coded...
String s("\\placebox{%}{%}{%}");
Array<String> a;
- a.add(print_dimen(off.y));
- a.add(print_dimen(off.x));
- a.add(sym.tex);
+ a.push(print_dimen(off.y));
+ a.push(print_dimen(off.x));
+ a.push(sym.tex);
return substitute_args(s, a);
}
assert(ps && pc);
for (iter_top(pc->its,i); i.ok(); i++){
if (i->pstaff_l_ == ps)
- ret.add((Item*)(const Item*)i);
+ ret.push((Item*)(const Item*)i);
}
return ret;
}
void
Mixed_qp::add_fixed_var(int i, Real r)
{
- eq_cons.add(i);
- eq_consrhs.add(r);
+ eq_cons.push(i);
+ eq_consrhs.push(r);
}
void
Ineq_constrained_qp::add_inequality_cons(Vector c, double r)
{
- cons.add(c);
- consrhs.add(r);
+ cons.push(c);
+ consrhs.push(r);
}
Ineq_constrained_qp::Ineq_constrained_qp(int novars):
Real R=cons[i] * sol- consrhs[i];
assert(R> -EPS);
if (R < EPS)
- binding.add(i);
+ binding.push(i);
}
// KKT check...
// todo
if (d == durations[i])
return ;
}
- durations.add(d);
+ durations.push(d);
}
void
add_score(Input_score * s)
{
- score_array_global.add(s);
+ score_array_global.push(s);
}
#include "molecule.hh"
#include "lookup.hh"
-Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_l)
+NAME_METHOD(Script);
+
+void
+Script::set_stem(Stem*st_l)
{
- dependencies.add(st_l);
- dependencies.add(i);
-
+ stem_l_ = st_l;
+ dependencies.push(st_l);
+}
+
+void
+Script::set_support(Item*i)
+{
+ support.push(i);
+ dependencies.push(i);
+}
+
+Script::Script(Script_req* rq, int staflen)
+{
staffsize =staflen;
specs_l_ = rq->scriptdef;
- support= i;
- stem_l_ = st_l;
+ stem_l_ = 0;
pos = 0;
symdir=1;
dir =rq->dir;
}
}
+Interval
+Script::support_height() const return r;
+{
+ for (int i=0; i < support.size(); i++)
+ r.unite(support[i]->height());
+}
+
void
Script::set_default_pos()
{
int d = specs_l_->staffdir;
Real y ;
if (!d) {
- Interval v= support->height();
+ Interval v= support_height();
y = v[dir] -dy[-dir] + 2*dir*inter_f;
} else {
Real y = (d > 0) ? staffsize + 2: -2; // ug
y *=inter_f;
- Interval v= support->height();
+ Interval v= support_height();
if (d > 0) {
y = y >? v.max();
staff_l_ = rs;
beam_ = 0;
text_=0;
- lreq_p_ = 0;
+
}
Simple_staff::Simple_staff()
theline_l_ = 0;
}
-/**
- accept:
-
- BREAK: all
- TYPESET: bar, meter,
-Scalar
- */
-
void
-Simple_column::process_requests()
+Simple_column::setup_requests()
{
for (int i = 0 ; i < v_elts.size(); i ++)
for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
}
}
if (rq->rhythmic()){
- notes.add(rq->rhythmic());
+ notes.push(rq->rhythmic());
}
if (rq->script()) {
- notes.last().scripts.add(rq->script());
+ notes.last().scripts.push(rq->script());
}
if (rq->stem()) {
stem_ = rq->stem();
if (rq->text()) {
text_ = rq->text();
}
-#if 0
- if (rq->lreq_l()) {
- lreq_p_ = rq->lreq_l();
- }
-#endif
if (rq->beam()) {
beam_ = rq->beam();
}
if (rq->slur()) {
- slurs.add(rq->slur());
+ slurs.push(rq->slur());
}
}
}
Simple_staff::walk()
{
for (Simple_walker sc(this); sc.ok(); sc++) {
- sc.col()->process_requests();// TODO
+ sc.col()->setup_requests();// TODO
sc.process();
}
}
#include "slur.hh"
#include "localkeyitem.hh"
#include "textitem.hh"
-#include "lyricitem.hh"
+
Rhythmic_grouping
parse_grouping(Array<Scalar> a, Moment one_beat)
{
Array<int> r;
for (int i= 0 ; i < a.size(); i++)
- r.add(a[i]);
+ r.push(a[i]);
Moment here =0.0;
Array<Rhythmic_grouping*> children;
Moment last = here;
here += one_beat * r[i];
- children.add(
+ children.push(
new Rhythmic_grouping(MInterval(last, here), r[i] )
);
}
void
Simple_walker::do_local_key(Note_req*n,Notehead* head_p)
{
- if ( local_key_.oct(n->octave).acc(n->name) != n->accidental) {
+ if ( local_key_.oct(n->octave).acc(n->notename) != n->accidental) {
if (!local_key_item_) {
local_key_item_ = staff()->get_local_key_item();
local_key_item_->c0_position = clef_.c0_pos;
}
-
- local_key_item_->add(n->octave, n->name, n->accidental, head_p);
- local_key_.oct(n->octave).set(n->name, n->accidental);
+ local_key_item_->add(head_p);
+ local_key_item_->add(n->octave, n->notename, n->accidental);
+ local_key_.oct(n->octave).set(n->notename, n->accidental);
}
}
{
Simple_column*c = col();
Simple_staff *s = staff();
- Item*rhythmic=0;
+ Item*rhythmic=0;
if (n.rq->note()) {
Note_req * req = n.rq->note() ;
- const Voice *v = req->elt_l_->voice_;
+ const Voice *v = req->elt_l_->voice_l_;
Notehead*n = s->get_notehead(req, clef_.c0_pos);
rhythmic=n;
current_grouping->add_child(
c->tdescription_->whole_in_measure, req->duration());
}
- noteheads.add(n);
+ noteheads.push(n);
int sidx =find_slur(v);
if (sidx >= 0) {
pending_slurs[sidx]->add(n);
if (wantkey)
do_local_key(req,n);
- }else if (n.rq->rest()) {
+ } else if (n.rq->rest()) {
rhythmic = s->get_rest(n.rq->rest());
c->typeset_item(rhythmic);
}
- for (int i= 0; i < n.scripts.size(); i ++)
- c->typeset_item(new Script(n.scripts[i], rhythmic, 10, stem_)); // UGR
+ for (int i= 0; i < n.scripts.size(); i ++) {
+ Script * s_p =new Script(n.scripts[i], 10);
+ s_p->set_support(rhythmic);
+ s_p->set_stem(stem_);
+ c->typeset_item(s_p); // UGR
+ }
}
void
Simple_column*c = col();
Simple_staff *s = staff();
- if (c->beam_&& c->beam_->spantype == Span_req::START) {
+ if (c->beam_ && c->beam_->spantype == Span_req::START) {
if (beam_)
error("Too many beams (t = "
+String(c->when())+")");
Slur_req*sl = c->slurs[i];
if (sl->spantype == Span_req::START) {
- if (find_slur(sl->elt_l_->voice_ )>=0)
+ if (find_slur(sl->elt_l_->voice_l_)>=0)
error_t("Too many slurs in voice", *col()->tdescription_);
- pending_slur_reqs.add(sl);
- pending_slurs.add(new Slur);
+ pending_slur_reqs.push(sl);
+ pending_slurs.push(new Slur);
}
}
c->typeset_item(new Text_item(c->text_, 10)); // UGR
}
-// if (c->lreq_p_) {
-// c->typeset_item(new Lyric_item(c->lreq_p_, 10)); // UGR
-// }
-
if (c->stem_) {
- stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len);
+ stem_ = s->get_stem(c->stem_->stem());
}
for (int i = 0; i < c->notes.size(); i ++) {
}
if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
+ if (!beam_) {
+ error_t("No beam to end", *col()->tdescription_);
+ }
default_grouping.extend(current_grouping->interval());
beam_->set_grouping(default_grouping, *current_grouping);
- pscore_->typeset_spanner(beam_, s->theline_l_);
+ pscore_l_->typeset_spanner(beam_, s->theline_l_);
if (c->beam_->nplet) {
- Text_spanner* t = new Text_spanner(beam_);
+ Text_spanner* t = new Text_spanner;
+ t->set_support(beam_);
t->spec.align_i_ = 0;
t->spec.text_str_ = c->beam_->nplet;
- pscore_->typeset_spanner(t, s->theline_l_);
+ pscore_l_->typeset_spanner(t, s->theline_l_);
}
beam_ = 0;
noteheads.set_size(0);
if (local_key_item_) {
- c->typeset_item_directional(local_key_item_, -1);
+ c->typeset_item(local_key_item_);
local_key_item_ = 0;
}
if (stem_) {
Slur_req *sl = c->slurs[i];
if (sl->spantype == Span_req::STOP) {
- int idx = find_slur(sl->elt_l_->voice_);
+ int idx = find_slur(sl->elt_l_->voice_l_);
if (idx < 0)
error_t("can't find slur to end; ", *c->tdescription_);
- pscore_->typeset_spanner(pending_slurs[idx],
+ pscore_l_->typeset_spanner(pending_slurs[idx],
s->theline_l_);
pending_slurs.del(idx);
pending_slur_reqs.del(idx);
}
}
+Simple_walker::Simple_walker(Simple_walker const&)
+ : Staff_walker(0, 0)
+{
+ assert(false);
+}
+Simple_walker::~Simple_walker()
+{
+ if (pending_slurs.size())
+ WARN << "destructing " << pending_slurs.size() << " Pending slurs ";
+ if (beam_)
+ WARN << "destructing Beam\n";
+ if (local_key_item_)
+ WARN<<"destructing Local_key_item\n";
+ if (stem_)
+ WARN<< "destructing Stem\n";
+ delete local_key_item_;
+ delete stem_;
+ delete beam_;
+
+}
+
Simple_walker::Simple_walker(Simple_staff*s)
: Staff_walker(s, s->theline_l_->pscore_l_)
{
wantkey =i;
delete i;
local_key_item_ = 0;
- reset();
+ do_post_move();
}
Simple_staff*
Simple_walker::staff()
{
- return (Simple_staff*) staff_;
+ return (Simple_staff*) staff_l_;
}
Simple_column*
}
void
-Simple_walker::reset()
+Simple_walker::do_post_move()
{
processed_clef =false;
processed_key = false;
Simple_walker::find_slur(const Voice *v)
{
for (int i=0; i < pending_slur_reqs.size(); i++) {
- if (pending_slur_reqs[i]->elt_l_->voice_ == v)
+ if (pending_slur_reqs[i]->elt_l_->voice_l_== v)
return i;
}
return -1;
#include "molecule.hh"
#include "debug.hh"
#include "boxes.hh"
-
+NAME_METHOD(Slur);
Slur::Slur()
{
dir = 0;
void
Slur::add(Notehead*n)
{
- encompass.add(n);
- dependencies.add(n);
+ encompass.push(n);
+ dependencies.push(n);
}
void
dir = 1;
}
-void
-Slur::print()const
-{
- mtor << "Slur.\n";
-}
-
void
Slur::do_pre_processing()
{
ret->encompass.set_size(0);
for (int i =0; i < encompass.size(); i++) {
if (encompass[i]->pcol_l_->line_l_==l->line_l_)
- ret->encompass.add(encompass[i]);
+ ret->encompass.push(encompass[i]);
}
if (right != r)
ret->open_right = true;
#include "spanner.hh"
#include "pcol.hh"
+NAME_METHOD(Spanner);
+void
+Spanner::do_print()const
+{
+ mtor << " (unknown) ";
+}
Spanner*
Spanner::broken_at(PCol*c1, PCol *c2)const
{
Spanner *span_p = do_break_at(c1,c2);
me_p->calc_children = true;
- me_p->dependencies.add(span_p);
+ me_p->dependencies.push(span_p);
span_p->calc_children = false; // should handle in ctor
Interval
Spanner::width()const
{
- Real r =right->hpos,
- l= left->hpos;
+ Real r = right->hpos;
+ Real l = left->hpos;
+ assert(*left < *right);
assert(r>=l);
return Interval(0, r-l);
}
-
-void
-Spanner::print() const
-{
-#ifndef NPRINT
- mtor << "Spanner { ";
- Staff_elem::print();
- mtor << "}\n";
-#endif
-}
-
Staff_column *
Staff::get_col(Moment w, bool mus)
{
- Score_column* sc = score_l_->find_col(w,mus);
+ Score_column* sccol_l = score_l_->find_col(w,mus);
iter_top(cols,i);
for (; i.ok(); i++) {
- if (*i->score_column_l_ > *sc) // too far
+ if (*i->score_column_l_ > *sccol_l) // too far
break;
- if (sc == i->score_column_l_)
+ if (sccol_l == i->score_column_l_)
return i;
}
/* post: *sc > *->score_column_l_ || !i.ok() */
- Staff_column* newst = create_col(sc);
+ Staff_column* newst = create_col(sccol_l);
if (!i.ok()) {
cols.bottom().add(newst);
for (iter_top(i->elts,j); j.ok(); j++) {
for (iter_top(j->reqs, k); k.ok(); k++) {
if (k->mark()) { // ugh. 4 levels
- s_arr.add(k->mark()->mark_str_);
- m_arr.add(now);
+ s_arr.push(k->mark()->mark_str_);
+ m_arr.push(now);
}
}
now += j->duration;
#ifndef NDEBUG
cols.OK();
voices.OK();
+ iter_top(cols, i);
+ iter_top(cols, j);
+ i++;
+ for (; i.ok(); j++,i++) {
+ if ( j->when() == i->when())
+ assert(!j->mus() && i->mus());
+ else
+ assert(j->when () < i->when() );
+ }
assert(score_l_);
#endif
}
{ /* every line a currentkey. */
Command kc;
kc.code =TYPESET;
- kc.args.add( "CURRENTKEY");
+ kc.args.push( "CURRENTKEY");
kc.priority = 60;
add(kc);
}
{ /* every line a currentclef. */
Command kc;
kc.code =TYPESET;
- kc.args.add( "CURRENTCLEF");
+ kc.args.push( "CURRENTCLEF");
kc.priority = 80;
add(kc);
}
score_column_l_->add_duration(d);
}
- v_elts.add(ve);
+ v_elts.push(ve);
}
Staff_column::Staff_column(Score_column *s_l)
#include "misc.hh"
const int STEMLEN=7;
-
-Stem::Stem(int c, Moment len)
+NAME_METHOD(Stem);
+Stem::Stem(int c) //, Moment len)
{
- note_length = len;
+// note_length = len;
beams_left = 0;
beams_right = 0;
minnote = 1000; // invalid values
}
void
-Stem::print() const
+Stem::do_print() const
{
#ifndef NPRINT
- mtor << "{\n";
mtor << "flag "<< flag << " print_flag " << print_flag
<< "min,max [" << minnote << ", " << maxnote << "]";
-
-
- Item::print();
- mtor << "}\n";
#endif
}
void
minnote = p;
if ( p> maxnote)
maxnote = p;
- heads.add(n);
- n->dependencies.add(this);
+ heads.push(n);
+ n->dependencies.push(this);
}
{
Array<String> sv;
for (int i = 0 ; i < args.size(); i++)
- sv.add(args[i]);
+ sv.push(args[i]);
return substitute_args(source, sv);
}
#include "textdef.hh"
#include "debug.hh"
-Text_spanner::Text_spanner(Directional_spanner*d)
+NAME_METHOD(Text_spanner);
+
+void
+Text_spanner::set_support(Directional_spanner*d)
{
support = d;
- dependencies.add(d);
+ dependencies.push(d);
+}
+Text_spanner::Text_spanner()
+{
+ support = 0;
+}
+
+void
+Text_spanner::do_print() const
+{
+ spec.print();
}
void
return output;
}
-void
-Text_spanner::print() const // todo
-{
-#ifndef NDEBUG
- mtor << "Text_spanner\n";
-#endif
-}
-
void
Text_spanner::do_pre_processing()
{
Spanner*
Text_spanner::do_break_at(PCol*c1, PCol*c2)const
{
- return new Text_spanner(*this);
+ return new Text_spanner(*this); // todo
}