include "dutch.ini" # do not include init/ path
-include "script.ini"
-include "table_sixteen.ini"
+include "script.ini"
+include "table_sixteen.ini" # not needed if doing MIDI
melodie = music {
$\clef\violin
c c | g g | a a | g2
- f f | e e | d d8.( e16 | )c2 | % :|
+ f f | e e | d d8. e16 | c2 | % :|
$
}
commands {
meter { 2 * 4}
}
+ paper{}
midi {
tempo 4:120
}
#include "leastsquares.hh"
#include "pcol.hh"
#include "stem.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
#include "grouping.hh"
-NAME_METHOD(Beam);
+
struct Stem_info {
Real x;
Beam::add(Stem*s)
{
stems.bottom().add(s);
- s->add_depedency(this);
+ s->add_dependency(this);
s->print_flag = false;
}
--- /dev/null
+#include "local-key-item.hh"
+#include "molecule.hh"
+#include "scalar.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+#include "musicalrequest.hh"
+#include "notehead.hh"
+#include "misc.hh"
+
+
+
+Local_key_item::Local_key_item(int i)
+{
+ c0_position = i;
+}
+
+void
+Local_key_item::add(Item*head_l)
+{
+ support_items_.push(head_l);
+ add_dependency(head_l);
+}
+
+void
+Local_key_item::add(Melodic_req*m_l)
+{
+ add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
+}
+void
+Local_key_item::add (int o, int p , int a)
+{
+ Local_acc l;
+ l.octave = o;
+ l.name = p;
+ l.acc = a;
+ accs.push(l);
+}
+
+void
+Local_key_item::do_pre_processing()
+{
+ accs.sort(Local_acc::compare);
+}
+
+Molecule*
+Local_key_item::brew_molecule_p()const
+{
+ Molecule* output = new Molecule;
+ Molecule*octmol = 0;
+ int lastoct = -100;
+ for (int i = 0; i < accs.size(); i++) {
+ // do one octave
+ if (accs[i].octave != lastoct) {
+ if (octmol){
+ Real dy =lastoct*7*paper()->internote();
+ octmol->translate(Offset(0, dy));
+ output->add(*octmol);
+ delete octmol;
+ }
+ octmol= new Molecule;
+ }
+ lastoct = accs[i].octave;
+ Symbol s =paper()->lookup_p_->accidental(accs[i].acc);
+ Atom a(s);
+ Real dy = (accs[i].name + c0_position) * paper()->internote();
+ a.translate(Offset(0,dy));
+
+ octmol->add_right(a);
+ }
+
+ if (octmol){
+ Real dy =lastoct*7*paper()->internote();
+ octmol->translate(Offset(0, dy));
+ output->add(*octmol);
+ delete octmol;
+ }
+
+ Interval head_width=itemlist_width(support_items_);
+ output->translate(Offset(-output->extent().x.right + head_width.left ,0));
+
+ return output;
+}
+
+int
+Local_acc::compare(Local_acc&a, Local_acc&b)
+{
+ if (a.octave - b.octave)
+ return a.octave - b.octave;
+ if (a.name - b.name)
+ return a.name - b.name;
+
+ assert(false);
+};
#include "musicalrequest.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "script.hh"
#include "stem.hh"
#include "molecule.hh"
#include "lookup.hh"
-NAME_METHOD(Script);
+
void
Script::set_stem(Stem*st_l)
{
stem_l_ = st_l;
- add_depedency(st_l);
+ add_dependency(st_l);
}
void
Script::set_support(Item*i)
{
support.push(i);
- add_depedency(i);
+ add_dependency(i);
}
Script::Script(Script_req* rq, int staflen)
#include "slur.hh"
#include "scalar.hh"
#include "lookup.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "notehead.hh"
#include "pcol.hh"
#include "molecule.hh"
#include "debug.hh"
#include "boxes.hh"
-NAME_METHOD(Slur);
+
Slur::Slur()
{
Slur::add(Notehead*n)
{
encompass.push(n);
- add_depedency(n);
+ add_dependency(n);
}
void
--- /dev/null
+#include "pscore.hh"
+#include "symbol.hh"
+#include "pstaff.hh"
+#include "molecule.hh"
+#include "staff-elem.hh"
+#include "debug.hh"
+
+String
+Staff_elem::TeXstring() const
+{
+ Molecule m(*output);
+ m.translate(offset_); // ugh?
+ return m.TeXstring();
+}
+
+Staff_elem::Staff_elem(Staff_elem const&s)
+ : dependants(s.dependants),
+ dependencies(s.dependencies)
+{
+ status = s.status;
+ assert(!s.output);
+ output = 0;
+ pstaff_l_ = s.pstaff_l_;
+ offset_ = Offset(0,0);
+}
+/**
+ TODO:
+ If deleted, then remove dependants depency!
+ */
+Staff_elem::~Staff_elem()
+{
+ delete output;
+}
+
+void
+Staff_elem::translate(Offset O)
+{
+ offset_ += O;
+}
+Interval
+Staff_elem::width() const
+{
+ Interval r;
+
+ if (!output){
+ Molecule*m = brew_molecule_p();
+ r = m->extent().x;
+ delete m;
+ } else
+ r = output->extent().x;
+
+ if (!r.empty()) // float exception on DEC Alpha
+ r+=offset_.x;
+
+ return r;
+}
+Interval
+Staff_elem::height() const
+{
+ Interval r;
+
+ if (!output){
+ Molecule*m = brew_molecule_p();
+ r = m->extent().y;
+ delete m;
+ } else
+ r = output->extent().y;
+
+ if (!r.empty())
+ r+=offset_.y;
+
+
+ return r;
+}
+
+void
+Staff_elem::print()const
+{
+#ifndef NPRINT
+ mtor << name() << "{\n";
+ do_print();
+ if (output)
+ output->print();
+
+ mtor << "}\n";
+#endif
+}
+
+
+
+Staff_elem::Staff_elem()
+{
+ pstaff_l_=0;
+ offset_ = Offset(0,0);
+ output = 0;
+ status = ORPHAN;
+}
+
+
+Paper_def*
+Staff_elem::paper() const
+{
+ assert(pstaff_l_);
+ return pstaff_l_->pscore_l_->paper_l_;
+}
+
+void
+Staff_elem::add_processing()
+{
+ if (status >= VIRGIN)
+ return;
+ status = VIRGIN;
+ do_add_processing();
+}
+
+void
+Staff_elem::pre_processing()
+{
+ if (status >= PRECALCED )
+ return;
+ assert(status != PRECALCING); // cyclic dependency
+ status = PRECALCING;
+
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->pre_processing();
+
+
+ do_pre_processing();
+ status = PRECALCED;
+}
+void
+Staff_elem::post_processing()
+{
+ if (status >= POSTCALCED)
+ return;
+ assert(status != POSTCALCING);// cyclic dependency
+ status=POSTCALCING;
+
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->post_processing();
+ do_post_processing();
+ status=POSTCALCED;
+}
+
+void
+Staff_elem::molecule_processing()
+{
+ if (status >= OUTPUT)
+ return;
+ status = OUTPUT; // do it only once.
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->molecule_processing();
+
+ output= brew_molecule_p();
+}
+
+void
+Staff_elem::do_post_processing()
+{
+}
+
+void
+Staff_elem::do_pre_processing()
+{
+}
+
+void
+Staff_elem::do_add_processing()
+{
+}
+
+void
+Staff_elem::substitute_dependency(Staff_elem * old, Staff_elem * newdep)
+{
+ bool hebbes_b=false;
+ for (int i=0; i < dependencies.size(); i++) {
+ if (dependencies[i] == old){
+ dependencies[i] = newdep;
+ hebbes_b = true;
+ } else if (dependencies[i] == newdep) {
+ hebbes_b = true;
+ }
+ }
+ if (!hebbes_b)
+ dependencies.push(newdep);
+}
+
+void
+Staff_elem::add_dependency(Staff_elem * p)
+{
+ for (int i=0; i < dependencies.size(); i ++)
+ if (dependencies[i] == p)
+ return;
+
+ dependencies.push(p);
+ p->dependants.push(p);
+}
#include "stem.hh"
#include "dimen.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "notehead.hh"
#include "lookup.hh"
#include "molecule.hh"
#include "misc.hh"
const int STEMLEN=7;
-NAME_METHOD(Stem);
+
Stem::Stem(int c) //, Moment len)
{
// todo: margins
if (! ((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)) )
- WARN << "Weird stem size; check for narrow beams.\n";
+ warning("Weird stem size; check for narrow beams",0);
top = (dir < 0) ? maxnote : se;
bot = (dir < 0) ? se : minnote;
if (n->balltype == 1)
return;
int p = n->position;
- if ( p < minnote)
+ if (p < minnote)
minnote = p;
- if ( p> maxnote)
+ if (p > maxnote)
maxnote = p;
heads.push(n);
- n->add_depedency(this);
+ n->add_dependency(this);
}
void
Stem::set_default_extents()
{
- assert(minnote<=maxnote);
+ if (minnote > maxnote) {
+ warning("Empty stem. Ugh!", 0);
+ minnote = -10;
+ maxnote = 20;
+ }
if (!stemlen)
set_default_stemlen();
void
Stem::set_noteheads()
{
+ if(!heads.size())
+ return;
heads.sort(Notehead::compare);
heads[0]->extremal = -1;
heads.top()->extremal = 1;
{
if (!print_flag || abs(flag) <= 4)
return Interval(0,0); // TODO!
- Paperdef*p= paper();
+ Paper_def*p= paper();
Interval r(p->lookup_p_->flag(flag).dim.x);
r+= stem_xoffset;
return r;
assert(bot!=top);
- Paperdef *p =paper();
+ Paper_def *p =paper();
Real dy = p->internote();
Symbol ss =p->lookup_p_->stem(bot*dy,top*dy);
#include "molecule.hh"
#include "boxes.hh"
#include "textspanner.hh"
-#include "textdef.hh"
+#include "text-def.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
+
-NAME_METHOD(Text_spanner);
void
Text_spanner::set_support(Directional_spanner*d)
{
support = d;
- add_depedency(d);
+ add_dependency(d);
}
Text_spanner::Text_spanner()