Accidental(int type, int position);
void print()const;
private:
- void brew_molecole();
+ void brew_molecule();
};
#endif // ACCIDENTAL_HH
#include "item.hh"
#include "vray.hh"
+
+///
struct Keyitem : Item {
svec<int> pitch;
svec<int> acc;
int c_position;
+
/****************/
Keyitem(int cposition);
void add(int pitch, int acc);
void read(svec<int> k);
+
void preprocess();
-private:
- void brew_molecole();
+ Molecule* brew_molecule()const;
};
+/**
+ An item which places accidentals at the start of the line
+ */
+
#endif // KEYITEM_HH
struct Local_key_item : Item {
svec<Local_acc> accs;
-
- int c0_position;
+ svec<Notehead*> group;
+ int c0_position; // move into walker
/****************/
Local_key_item(int c0position);
- void add(int oct, int pitch, int acc);
-
- void preprocess();
-
-private:
- void brew_molecole();
+ void add(int oct, int pitch, int acc, Notehead*);
+ void do_pre_processing();
+ Molecule* brew_molecule()const;
};
#endif // LOCALKEYITEM_HH
/****************/
- void preprocess();
+
Rest(int dur,int dots);
void print()const;
-private:
- void brew_molecole();
+
+ Molecule* brew_molecule()const;
};
/**
takes care of:
svec<Notehead*> heads;
/****************/
-
+ Stem(int center, Moment duration);
+
/// ensure that this Stem also encompasses the Notehead #n#
void add(Notehead*n);
+
Real hpos()const;
void print() const;
void set_stemend(Real);
void set_default_stemlen();
void set_default_extents();
void set_noteheads();
- void postprocess();
- void preprocess();
- Stem(int center, Moment duration);
+
+
+ void do_pre_processing();
Interval width() const;
-private:
- void brew_molecole();
+ Molecule* brew_molecule() const;
};
/**
takes care of:
--- /dev/null
+/*
+ text.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef TEXT_ITEM_HH
+#define TEXT_ITEM_HH
+
+#include "textdef.hh"
+#include "item.hh"
+
+struct Text_item : Item{
+ int pos;
+ int staffsize;
+ int dir;
+ Text_def*specs;
+
+ /****************/
+
+ void set_default_pos();
+ Molecule* brew_molecule()const;
+ void do_pre_processing();
+
+ Text_item(Text_req*,int);
+};
+
+
+#endif // TEXT_HH
+
read(k.clef_type);
}
-void
-Clef_item::preprocess()
+Molecule*
+Clef_item::brew_molecule()const
{
String t = type;
if (change)
t += "_change";
Symbol s = paper()->lookup_->clef(t);
- output = new Molecule(Atom(s));
+ Molecule*output = new Molecule(Atom(s));
output->translate(Offset(0, paper()->interline()/2 * y_off));
+ return output;
}
add(note, acc);
}
}
+
void
Keyitem::add(int p, int a)
{
acc.add(a);
}
-void
-Keyitem::preprocess()
-{
- brew_molecole();
-}
-void
-Keyitem::brew_molecole()
+Molecule*
+Keyitem::brew_molecule()const
{
- output = new Molecule;
+ Molecule*output = new Molecule;
Real inter = paper()->interline()/2;
for (int i =0; i < pitch.sz(); i++) {
Molecule m(paper()->lookup_->fill(Box(
Interval(0, paper()->note_width()),
Interval(0,0))));
- output->add_right(m);
+ output->add_right(m);
+ return output;
}
#include "scalar.hh"
#include "lookup.hh"
#include "paper.hh"
-
+#include "notehead.hh"
Local_key_item::Local_key_item(int i)
{
c0_position = i;
}
void
-Local_key_item::add (int o, int p , int a)
+Local_key_item::add (int o, int p , int a,Notehead*head_p)
{
Local_acc l;
l.octave = o;
l.name = p;
l.acc = a;
accs.add(l);
+ group.add(head_p);
+ dependencies.add(head_p);
}
void
-Local_key_item::preprocess()
+Local_key_item::do_pre_processing()
{
- brew_molecole();
+ accs.sort(Local_acc::compare);
}
-
-void
-Local_key_item::brew_molecole()
+Molecule*
+Local_key_item::brew_molecule()const
{
- accs.sort(Local_acc::compare);
- output = new Molecule;
+ Molecule* output = new Molecule;
Molecule*octmol = 0;
int lastoct = -100;
for (int i = 0; i < accs.sz(); i++) {
output->add(*octmol);
delete octmol;
}
+ return output;
}
int
#include "misc.hh"
-
#include "notehead.hh"
#include "dimen.hh"
#include "debug.hh"
#endif
}
-void
-Notehead::preprocess()
-{
- brew_molecole();
-}
int
Notehead::compare(Notehead*&a, Notehead*&b)
return a->position - b->position;
}
-void
-Notehead::brew_molecole()
+Molecule*
+Notehead::brew_molecule() const return out;
{
- assert(pstaff_);
- assert(!output);
-
Paperdef *p = paper();
Real dy = p->internote();
Symbol s = p->lookup_->ball(balltype);
- output = new Molecule(Atom(s));
+ out = new Molecule(Atom(s));
if (dots) {
Symbol d = p->lookup_->dots(dots);
Molecule dm;
dm.add(Atom(d));
if (!(position %2))
dm.translate(Offset(0,dy));
- output->add_right(dm);
+ out->add_right(dm);
}
- output->translate(Offset(x_dir * p->note_width(),0));
+ out->translate(Offset(x_dir * p->note_width(),0));
bool streepjes = (position<-1)||(position > staff_size+1);
if (streepjes) {
int dir = sign(position);
sm.add(Atom(str));
if (position % 2)
sm.translate(Offset(0,-dy* dir));
- output->add(sm);
+ out->add(sm);
}
- output->translate(Offset(0,dy*position));
+ out->translate(Offset(0,dy*position));
}
Item::print();
}
-void
-Rest::preprocess()
-{
- brew_molecole();
-}
-
-void
-Rest::brew_molecole()
+Molecule*
+Rest::brew_molecule()const
{
assert(pstaff_);
- assert(!output);
+
Paperdef *p =paper();
Symbol s;
dm.add(Atom(d));
m->add_right(dm);
}
- output = m;
+ return m;
}
/*
UGR
*/
-
+#include "textspanner.hh"
+#include "script.hh"
#include "request.hh"
#include "voice.hh"
#include "clef.hh"
#include "keyitem.hh"
#include "slur.hh"
#include "localkeyitem.hh"
+#include "textitem.hh"
Rhythmic_grouping
parse_grouping(svec<Scalar> a, Moment one_beat)
{
-
svec<int> r;
for (int i= 0 ; i < a.sz(); i++)
r.add(a[i]);
svec<Scalar> args(com->args);
args.del(0);
if (com->args[0] == "GROUPING") {
- default_grouping = parse_grouping(args, col()->tdescription_->one_beat);
+ default_grouping = parse_grouping(args,
+ col()->tdescription_->one_beat);
}else if (com->args[0] == "BAR") {
local_key_.reset(key_);
} else if (com->args[0] == "KEY") {
- if (col()->when()) {
+ if (col()->when() > Moment(0)) {
assert(!oldkey_undo);
oldkey_undo = new svec<int>( key_.oldkey_undo(args));
}
if (processed_key)
return;
else
- com->args[0] = "KEY";
+ com->args[0] = "KEY"; // urgh
if (com->args[0] == "CURRENTCLEF") {
if (processed_clef)
oldkey_undo = 0;
}
processed_key = true;
+
((Keyitem*) i)->read(typesetkey); // ugh
}
}
void
-Simple_walker::do_local_key(Note_req*n)
+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_item_) {
local_key_item_->c0_position = clef_.c0_pos;
}
- local_key_item_->add(n->octave, n->name, n->accidental);
+ local_key_item_->add(n->octave, n->name, n->accidental, head_p);
local_key_.oct(n->octave).set(n->name, n->accidental);
}
}
void
-Simple_walker::do_note(Rhythmic_req*rq)
+Simple_walker::do_note(Note_info n)
{
Simple_column*c = col();
Simple_staff *s = staff();
-
- if (rq->note()) {
- Note_req * req = rq->note() ;
+ Item*rhythmic=0;
+ if (n.rq->note()) {
+ Note_req * req = n.rq->note() ;
const Voice *v = req->elt->voice_;
-
+
Notehead*n = s->get_notehead(req, clef_.c0_pos);
+ rhythmic=n;
stem_->add(n);
if (current_grouping) {
current_grouping->add_child(
- c->tdescription_->whole_in_measure, rq->duration());
+ c->tdescription_->whole_in_measure, req->duration());
}
noteheads.add(n);
int sidx =find_slur(v);
}
if (wantkey)
- do_local_key(req);
+ do_local_key(req,n);
+ }else if (n.rq->rest()) {
+ rhythmic = s->get_rest(n.rq->rest());
+ c->typeset_item(rhythmic);
}
-
- if (rq->rest()) {
- c->typeset_item( s->get_rest(rq->rest()) );
- }
+ for (int i= 0; i < n.scripts.size(); i ++)
+ c->typeset_item(new Script(n.scripts[i], rhythmic, 10, stem_)); // UGR
}
void
{
Simple_column*c = col();
Simple_staff *s = staff();
+
if (c->beam_&& c->beam_->spantype == Span_req::START) {
if (beam_)
error("Too many beams (t = "
beam_ = new Beam;
current_grouping = new Rhythmic_grouping;
}
+
for (int i=0; i < c->slurs.sz(); i++) {
Slur_req*sl = c->slurs[i];
}
}
+ if (c->text_) {
+ c->typeset_item(new Text_item(c->text_, 10)); // UGR
+ }
+
if (c->stem_) {
stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len);
}
if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
beam_->set_grouping(default_grouping, *current_grouping);
pscore_->typeset_spanner(beam_, s->theline);
+
+ if (c->beam_->nplet) {
+ Text_spanner* t = new Text_spanner(beam_);
+ t->spec.align = 0;
+ t->spec.text = c->beam_->nplet;
+ pscore_->typeset_spanner(t, s->theline);
+ }
+
beam_ = 0;
delete current_grouping;
current_grouping =0;
--- /dev/null
+#include "request.hh"
+#include "paper.hh"
+#include "textitem.hh"
+#include "stem.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+
+Text_item::Text_item(Text_req * r, int s)
+{
+ dir = r->dir;
+ if (!dir)
+ dir = -1;
+
+ specs = r->spec;
+ staffsize = s;
+ pos = 0;
+}
+
+void
+Text_item::set_default_pos()
+{
+ pos = (dir > 0) ? staffsize + 2: -4;
+}
+void
+Text_item::do_pre_processing()
+{
+ set_default_pos();
+}
+
+
+Molecule*
+Text_item::brew_molecule() const
+{
+ Molecule* output = new Molecule(specs->create(paper()));
+ if(dir <0)
+ output->translate(Offset(0, -output->extent().y.length() ));
+
+ output->translate(Offset(0, pos * paper()->internote()));
+ return output;
+}