.* TODO
. * use hash tabs iso. alist_ for elt property?
+. * unhardcode stuff in bezier-bow: all sizes other than 20pt are
+ broken
. * control paper-size/-file from commandline ?
lilypond --paper=paper16 foo.ly
lilypond --paper=paper20 foo.ly
. * entangle ly/* paper-params papersize stuff
. * fix tremolos.
. * change ) c4 to c4-)
+. * automated marks.
+. * There should be no pagebreak below the title of the movement!!
+. * tempo:
+
+> - Tempo Indications:
+> * \tempo 4 = 60 should be printed
+> * There should be commands like \alloegro that also do something
+> sensible in midi.
+>
+. * - It should be possible to have Bar numbers on every bar.
+
+. * dynamics:
+> * Notes should be spaced out for crescendos (had to use c^" ")
+> * something like c-.->\ff looks ugly. The dynamc indication should
+> appear left of the marks
+>
. *
There's insufficient leading between lines of lyrics, so risers like
`l' and 'b' collide with the bottom of the line above.
\header{
-title = "sleur";
-subtitle = "test slurs.";
enteredby = "jcn";
copyright = "public domain";
+TestedFeatures = "This file tests Feta embedded slurs" +
+ "(Feta definitively is not an abbreviation of Font-En-TjA)";
}
\version "1.3.5";
}
\score{
- \notes{
+ \context Staff \notes{
% \property Voice.pletvisibility = 0;
% use blend for fast check
\blend
--- /dev/null
+\score{
+\notes\relative c''{
+
+\property Voice.slurVerticalDirection = #1
+\property Voice.stemVerticalDirection = #-1
+a(a' a,)a
+a(a a')a,
+a(d a)a
+a(a d)a
+
+e'8(e e e e e e)e
+a,8(d a a a a a)a
+a(a a a a a d)a
+
+c,(g' c e f d b)g
+c,(g' c e f d b)g
+
+\property Voice.noAutoBeaming = ##t
+\property Voice.stemVerticalDirection = #1
+a8(a a a a a a)a
+
+}
+\paper{
+indent=0.0\mm;
+}
+}
}
-
-#include "ly-smobs.icc"
-IMPLEMENT_SMOBS(Font_metric);
}
-Molecule*
-Bar::do_brew_molecule_p () const
+Molecule
+Bar::do_brew_molecule () const
{
String s = ly_scm2string (get_elt_property ("glyph"));
- Molecule *output
- = new Molecule (lookup_l ()->bar (s, get_bar_size (), paper_l ()));
-
- return output;
+ return lookup_l ()->bar (s, get_bar_size (), paper_l ());
}
}
-Molecule*
-Beam::do_brew_molecule_p () const
+Molecule
+Beam::do_brew_molecule () const
{
- Molecule *mol_p = new Molecule;
+ Molecule mol;
if (!stem_count ())
- return mol_p;
+ return mol;
Real x0,dx;
if (visible_stem_count ())
{
Molecule sb = stem_beams (i, next, prev);
Real x = i->hpos_f ()-x0;
sb.translate (Offset (x, x * dydx + y));
- mol_p->add_molecule (sb);
+ mol.add_molecule (sb);
}
- mol_p->translate_axis (x0
+ mol.translate_axis (x0
- spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS), X_AXIS);
- return mol_p;
+ return mol;
}
int
set_elt_property ("breakable", SCM_BOOL_T);
}
-Molecule*
-Breathing_sign::do_brew_molecule_p () const
+Molecule
+Breathing_sign::do_brew_molecule () const
{
Staff_symbol_referencer_interface si (this);
Interval i1(0, space / 6), i2(-space / 2, space / 2);
Box b(i1, i2);
- Molecule *output = new Molecule (lookup_l()->filledbox(b));
-
- return output;
+ return lookup_l()->filledbox(b);
}
void
TODO:
fix silly to-and-fro scm conversions
*/
-Molecule*
-Chord_name::do_brew_molecule_p () const
+Molecule
+Chord_name::do_brew_molecule () const
{
Array<Musical_pitch> pitch_arr;
scm_to_array (get_elt_property ("pitches"), &pitch_arr);
if (!name.addition_mol.empty_b ())
name.addition_mol.translate (Offset (0, super_y));
- Molecule* mol_p = new Molecule;
- mol_p->add_at_edge (X_AXIS, RIGHT, name.tonic_mol, 0);
+ Molecule mol;
+ mol.add_at_edge (X_AXIS, RIGHT, name.tonic_mol, 0);
// huh?
if (!name.modifier_mol.empty_b ())
- mol_p->add_at_edge (X_AXIS, RIGHT, name.modifier_mol, 0);
+ mol.add_at_edge (X_AXIS, RIGHT, name.modifier_mol, 0);
if (!name.addition_mol.empty_b ())
- mol_p->add_at_edge (X_AXIS, RIGHT, name.addition_mol, 0);
+ mol.add_at_edge (X_AXIS, RIGHT, name.addition_mol, 0);
if (!name.inversion_mol.empty_b ())
- mol_p->add_at_edge (X_AXIS, RIGHT, name.inversion_mol, 0);
+ mol.add_at_edge (X_AXIS, RIGHT, name.inversion_mol, 0);
if (!name.bass_mol.empty_b ())
- mol_p->add_at_edge (X_AXIS, RIGHT, name.bass_mol, 0);
- return mol_p;
+ mol.add_at_edge (X_AXIS, RIGHT, name.bass_mol, 0);
+ return mol;
}
-Molecule*
-Crescendo::do_brew_molecule_p () const
+Molecule
+Crescendo::do_brew_molecule () const
{
Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
Real extra_left = get_broken_left_end_align ();
if (!isdir_b (dir) || !gh_pair_p (dyns))
{
-Crescendo * me = (Crescendo*)this;
+ Crescendo * me = (Crescendo*)this;
me->set_elt_property ("transparent", SCM_BOOL_T);
- return new Molecule;
+ Molecule m;
+
+ return m;
}
Direction gd = to_dir (dir);
Real thick = paper_l ()->get_var ("crescendo_thickness");
const char* hairpin = (gd < 0)? "decrescendo" : "crescendo";
- Molecule * m
- = new Molecule;
- m->dim_.x () = Interval (0, width);
- m->dim_.y () = Interval (-2*height, 2*height);
+
+ Box b (Interval (0, width),
+ Interval (-2*height, 2*height));
SCM at = gh_list (ly_symbol2scm (hairpin),
gh_double2scm (thick),
gh_double2scm (continued ? height/2 : 0.0),
SCM_UNDEFINED);
- m->add_atom (at);
- m->translate_axis (extra_left, X_AXIS);
+ Molecule m (b, at);
+
+ m.translate_axis (extra_left, X_AXIS);
return m;
}
si.set_position (p + directional_element (this).get ());
}
}
-Molecule*
-Dots::do_brew_molecule_p () const
+Molecule
+Dots::do_brew_molecule () const
{
- Molecule *out = new Molecule;
- Molecule fill = lookup_l ()->fill (Box (Interval (0,0),
- Interval (0,0)));
- out->add_molecule (fill);
-
+ Molecule mol (lookup_l ()->fill (Box (Interval (0,0),
+ Interval (0,0))));
Molecule d = lookup_l ()->afm_find (String ("dots-dot"));
Real dw = d.dim_[X_AXIS].length ();
for (int i = gh_scm2int (get_elt_property ("dot-count")); i--; )
{
d.translate_axis (2*dw,X_AXIS);
- out->add_molecule (d);
+ mol.add_molecule (d);
}
- return out;
+ return mol;
}
-Molecule*
-Extender_spanner::do_brew_molecule_p () const
+Molecule
+Extender_spanner::do_brew_molecule () const
{
- Molecule* mol_p = new Molecule;
+ Molecule mol;
Real w = spanner_length ();
Molecule a = lookup_l ()->filledbox ( Box (Interval (0,w), Interval (0,h)));
a.translate (Offset (dx_f_drul_[LEFT], 0));
- mol_p->add_molecule (a);
+ mol.add_molecule (a);
- return mol_p;
+ return mol;
}
}
IMPLEMENT_UNSMOB(Font_metric, metrics);
+IMPLEMENT_SMOBS(Font_metric);
+
dim_cache_[Y_AXIS]->set_callback (Dimension_cache::point_dimension_callback);
}
-Molecule*
-Hyphen_spanner::do_brew_molecule_p () const
+Molecule
+Hyphen_spanner::do_brew_molecule () const
{
- Molecule* mol_p = new Molecule;
+ Molecule mol;
Real w = spanner_length ();
Molecule a = lookup_l ()->filledbox ( Box (Interval ((w-l)/2,(w+l)/2), Interval (h,h+th)));
a.translate (Offset (dx_f_drul_[LEFT], 0));
- mol_p->add_molecule (a);
+ mol.add_molecule (a);
- return mol_p;
+ return mol;
}
Bar();
protected:
virtual void do_pre_processing ();
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
virtual Real get_bar_size () const;
};
#endif // BAR_HH
virtual void do_pre_processing ();
virtual void do_post_processing ();
- virtual Molecule*do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
private:
Breathing_sign ();
protected:
virtual void do_post_processing ();
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
};
void banter (Array<Musical_pitch> pitch_arr, Chord_mol* name_p) const;
protected:
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
};
#endif // CHORD_NAME_HH
Crescendo();
protected:
VIRTUAL_COPY_CONS(Score_element);
- virtual Molecule*do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
private:
Molecule get_symbol() const;
public Item
{
protected:
- virtual Molecule * do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
virtual void do_post_processing ();
public:
void set_textitem (Direction, Item*);
protected:
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
void do_post_processing ();
VIRTUAL_COPY_CONS (Score_element);
void set_textitem (Direction, Item*);
protected:
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
Interval do_height () const;
void do_post_processing ();
int calculate_position(int p, int a) const;
protected:
- virtual Molecule* do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
};
#endif // KEYITEM_HH
void add_pitch (Musical_pitch, bool cautionary, bool natural);
protected:
virtual void do_pre_processing();
- virtual Molecule* do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
};
#endif // LOCALKEYITEM_HH
return SMOB_TO_TYPE(CL, s); \
else \
return 0; \
-}
+}\
+SCM smobify (CL *cl)\
+{\
+ SCM s; \
+ \
+ SCM_NEWCELL(s); \
+ SCM_SETCAR(s,CL::smob_tag_); \
+ void * me_p = cl; \
+ SCM_SETCDR(s,me_p); \
+return s;\
+}\
+
#define IMPLEMENT_SMOBS(CL)\
This is local. We don't assign to self_scm_ directly, to assure \
that S isn't GC-ed from under us. \
*/ \
- SCM s; \
- \
- SCM_NEWCELL(s); \
+ SCM s = smobify (this); \
self_scm_ = s; \
- \
- SCM_SETCAR(s,smob_tag_); \
- void * me_p = this; \
- SCM_SETCDR(s,me_p); \
scm_protect_object (s); \
\
/* no scm_done_malloc() ! */ \
#ifndef MOLECULE_HH
#define MOLECULE_HH
+#include <stdlib.h> // size_t
#include "lily-proto.hh"
#include "box.hh"
#include "axes.hh"
#include "direction.hh"
-#include "cons.hh"
-#include "protected-scm.hh"
-
-//#define ATOM_SMOB
+#include "lily-guile.hh"
/** a group of individually translated symbols. You can add molecules
to the top, to the right, etc.
+ It is implemented as a "tree" of scheme expressions, as in
+
+ Expr = combine Expr Expr
+ | translate Offset Expr
+ | SCHEME
+ ;
+
+ SCHEME is a Scheme expression that --when eval'd-- produces the
+ desired output.
+
+
+ Because of the way that Molecule is implemented, it is the most
+ efficient to add "fresh" molecules to what you're going to build.
+
Dimension behavior:
Empty molecules have empty dimensions. If add_at_edge is used to
init the molecule, we assume that
DIMENSIONS = (Interval(0,0),Interval(0,0)
-
+
*/
class Molecule {
- Protected_scm atom_list_;
-
- friend class Paper_outputter;
-
+ /// can't alloc on heap.
+ void * operator new (size_t s);
public:
Box dim_;
-
+ SCM expr_;
+
+ Molecule (Box, SCM s);
Molecule();
- ~Molecule();
/**
Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
void set_empty (bool);
void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
-
- /**
- Add an atom. The molecule assumes responsibility for cleaning.
- */
- void add_atom (SCM as);
void add_molecule (Molecule const &m);
void translate (Offset);
void translate_axis (Real,Axis);
+
/// how big is #this#?
Box extent() const;
Interval extent (Axis) const;
-
- Molecule (const Molecule&s);
-
- void operator=(const Molecule&);
bool empty_b() const;
void print ()const;
};
void add_column (Item*);
Molecule compound_rest (int)const;
protected:
- virtual Molecule *do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
VIRTUAL_COPY_CONS (Score_element);
virtual void do_add_processing ();
protected:
virtual void do_pre_processing();
- virtual Molecule* do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
};
#endif // NOTEHEAD_HH
#include "lily-guile.hh"
#include "protected-scm.hh"
+// huh?
#ifdef __powerpc__
#include "protected-scm.hh"
#endif
Paper_outputter ();
void dump_onto (Paper_stream *);
-
-
void output_int_def (String k, int v);
void output_Real_def (String k, Real v);
void output_String_def (String k, String v);
void output_font_def (int i, String str);
void output_font_switch (int i);
void output_header ();
- void output_molecule (Molecule const *, Offset, char const *);
+ void output_molecule (SCM expr, Offset, char const *);
void output_comment (String s);
void output_scheme (SCM scm);
{
protected:
virtual void do_post_processing ();
- virtual Molecule * do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
};
#endif // REST_HH
int status_i_;
Paper_score *pscore_l_;
- Molecule * output_p_;
+
Score_element ();
Score_element (Score_element const&);
virtual void print () const;
/// do printing of derived info.
virtual void do_print () const;
/// generate the molecule
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
///executed directly after the item is added to the Paper_score
virtual void do_add_processing ();
/// do calculations before determining horizontal spacing
protected:
virtual void do_pre_processing ();
virtual void do_post_processing ();
- Molecule* do_brew_molecule_p () const;
+ Molecule do_brew_molecule () const;
};
#endif /* Stem_SCRIPT_HH */
virtual void do_pre_processing();
virtual void do_post_processing();
- virtual Molecule * do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
};
#endif // SPAN_BAR_HH
int line_count () const;
protected:
VIRTUAL_COPY_CONS(Score_element);
- virtual Molecule* do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
};
#endif // STAFFSYM_HH
class Stem_tremolo : public Item {
protected:
Stem * stem_l () const;
- virtual Molecule *do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
static Interval dim_callback (Dimension_cache const*);
public:
virtual void do_pre_processing();
static Interval dim_callback (Dimension_cache const*);
- virtual Molecule* do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
void set_spacing_hints () ;
};
public:
VIRTUAL_COPY_CONS (Score_element);
protected:
- virtual Molecule *do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
};
#endif /* Text_ITEM_HH */
virtual Direction get_default_dir() const;
protected:
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
virtual Array<Offset> get_encompass_offset_arr () const;
Bezier get_curve () const;
Molecule time_signature (int, int)const;
protected:
- virtual Molecule*do_brew_molecule_p() const;
+ virtual Molecule do_brew_molecule() const;
public:
Time_signature () ;
void calc_dy (Real *) const;
void calc_position_and_height (Real*,Real *dy)const;
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
VIRTUAL_COPY_CONS(Score_element);
virtual void do_add_processing ();
virtual void do_post_processing ();
void add_bar (Bar*);
protected:
- virtual Molecule* do_brew_molecule_p () const;
+ virtual Molecule do_brew_molecule () const;
VIRTUAL_COPY_CONS (Score_element);
virtual void do_add_processing ();
- space the `natural' signs wider
- dehair this
*/
-Molecule*
-Key_item::do_brew_molecule_p() const
+Molecule
+Key_item::do_brew_molecule() const
{
- Molecule*output = new Molecule;
+ Molecule mol;
Staff_symbol_referencer_interface si (this);
Real inter = si.staff_space ()/2.0;
Molecule m =lookup_l ()->afm_find ("accidentals-0");
m.translate_axis (calculate_position(old_pitch_arr_[i], old_acc_arr_[i]) * inter, Y_AXIS);
- output->add_at_edge (X_AXIS, RIGHT, m,0);
+ mol.add_at_edge (X_AXIS, RIGHT, m,0);
}
}
Interval x(0, inter);
Interval y(0,0);
- output->add_at_edge (X_AXIS, RIGHT, lookup_l()->fill (Box(x,y)),0);
+ mol.add_at_edge (X_AXIS, RIGHT, lookup_l()->fill (Box(x,y)),0);
}
for (int i =0; i < pitch_arr_.size(); i++)
{
Molecule m = lookup_l ()->afm_find ("accidentals-" + to_str (acc_arr_[i]));
m.translate_axis (calculate_position(pitch_arr_[i], acc_arr_[i]) * inter, Y_AXIS);
- output->add_at_edge (X_AXIS, RIGHT, m, 0);
+ mol.add_at_edge (X_AXIS, RIGHT, m, 0);
}
- return output;
+ return mol;
}
return m;
}
-Molecule*
-Local_key_item::do_brew_molecule_p() const
+/*
+ UGH. clean me up
+ */
+Molecule
+Local_key_item::do_brew_molecule() const
{
- Molecule*output = new Molecule;
+ Molecule mol;
Staff_symbol_referencer_interface si (this);
Real note_distance = si.staff_space ()/2;
- Molecule *octave_mol_p = 0;
+ Molecule octave_mol;
+ bool oct_b = false;
int lastoct = -100;
for (int i = 0; i < accidental_arr_.size(); i++)
// do one octave
if (p.octave_i_ != lastoct)
{
- if (octave_mol_p)
+ if (oct_b)
{
Real dy =lastoct*7* note_distance;
- octave_mol_p->translate_axis (dy, Y_AXIS);
- output->add_molecule (*octave_mol_p);
- delete octave_mol_p;
+ octave_mol.translate_axis (dy, Y_AXIS);
+ mol.add_molecule (octave_mol);
+ octave_mol = Molecule ();
}
- octave_mol_p= new Molecule;
+ oct_b = true;
}
lastoct = p.octave_i_;
accidental_arr_[i].natural_b_));
m.translate_axis (dy, Y_AXIS);
- octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0);
+ octave_mol.add_at_edge (X_AXIS, RIGHT, m, 0);
}
- if (octave_mol_p)
+ if (oct_b)
{
Real dy =lastoct*7*note_distance;
- octave_mol_p->translate_axis (dy, Y_AXIS);
- output->add_molecule (*octave_mol_p);
- delete octave_mol_p;
+ octave_mol.translate_axis (dy, Y_AXIS);
+ mol.add_molecule (octave_mol);
+ octave_mol = Molecule ();
}
if (accidental_arr_.size())
Box b(Interval (0, gh_scm2double (pads[d]) * note_distance),
Interval (0,0));
Molecule m (lookup_l ()->fill (b));
- output->add_at_edge (X_AXIS, d, m, 0);
+ mol.add_at_edge (X_AXIS, d, m, 0);
} while ( flip (&d)!= LEFT);
}
- return output;
+ return mol;
}
#include "ly-smobs.icc"
+IMPLEMENT_UNSMOB(Moment,moment);
IMPLEMENT_SMOBS(Moment);
void
[TODO] 17
* variable-sized multi-measure rest symbol: |====| ??
*/
-Molecule*
-Multi_measure_rest::do_brew_molecule_p () const
+Molecule
+Multi_measure_rest::do_brew_molecule () const
{
Real staff_space
= staff_symbol_referencer (this).staff_space ();
sp_iv[d] = coldim[-d] ;
}
while ((flip (&d)) != LEFT);
- Molecule *mol_p = new Molecule;
+ Molecule mol;
Real x_off = 0.0;
Real rx = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS);
s = lookup_l ()->afm_find (idx);
}
- mol_p->add_molecule (s);
+ mol.add_molecule (s);
if (measures > 1)
{
Molecule s (lookup_l ()->text ("number", to_str (measures), paper_l ()));
s.align_to (X_AXIS, CENTER);
s.translate_axis (3.0 * staff_space, Y_AXIS);
- mol_p->add_molecule (s);
+ mol.add_molecule (s);
}
- mol_p->translate_axis (x_off, X_AXIS);
- return mol_p;
+ mol.translate_axis (x_off, X_AXIS);
+ return mol;
}
/*
{
Drul_array<Molecule> endings;
endings[LEFT] = lookup_l()->afm_find ("noteheads-ledgerending");
- Molecule * e = &endings[LEFT];
+ Molecule *e = &endings[LEFT];
endings[RIGHT] = *e;
Real thick = e->dim_[Y_AXIS].length();
-Molecule*
-Note_head::do_brew_molecule_p() const
+Molecule
+Note_head::do_brew_molecule() const
{
Staff_symbol_referencer_interface si (this);
type = ly_scm2string (style);
}
- Molecule* out =
- new Molecule (lookup_l()->afm_find (String ("noteheads-") + to_str (balltype_i ()) + type));
+ Molecule out = lookup_l()->afm_find (String ("noteheads-") + to_str (balltype_i ()) + type);
- Box ledgerless = out->dim_;
+ Box ledgerless = out.dim_;
if (streepjes_i)
{
Direction dir = (Direction)sign (p);
- Interval hd = out->dim_[X_AXIS];
+ Interval hd = out.dim_[X_AXIS];
Real hw = hd.length ()/4;
Molecule ledger (ledger_line (Interval (hd[LEFT] - hw,
Molecule s (ledger);
s.translate_axis (-dir * inter_f * (i*2 + parity),
Y_AXIS);
- out->add_molecule (s);
+ out.add_molecule (s);
}
}
- out->dim_ = ledgerless;
+ out.dim_ = ledgerless;
return out;
}
}
-Molecule *
-Rest::do_brew_molecule_p () const
+Molecule
+Rest::do_brew_molecule () const
{
bool ledger_b =false;
String idx = ("rests-") + to_str (balltype_i ()) + (ledger_b ? "o" : "") + style;
- return new Molecule(lookup_l ()->afm_find (idx));
+ return lookup_l ()->afm_find (idx);
}
{
}
-#include "ly-smobs.icc"
-IMPLEMENT_SMOBS(Scheme_hash_table);
SCM
Scheme_hash_table::mark_smob (SCM s)
return l;
}
+
+#include "ly-smobs.icc"
+IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash);
+IMPLEMENT_SMOBS(Scheme_hash_table);
Score_element::Score_element()
{
- output_p_ =0;
dim_cache_[X_AXIS] = new Dimension_cache;
dim_cache_[Y_AXIS] = new Dimension_cache;
dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
original_l_ =(Score_element*) &s;
element_property_alist_ = SCM_EOL; // onstack;
- output_p_ =0;
status_i_ = s.status_i_;
lookup_l_ = s.lookup_l_;
pscore_l_ = s.pscore_l_;
Score_element::~Score_element()
{
- assert (!output_p_);
assert (status_i_ >=0);
status_i_ = -1;
Score_element::molecule_extent(Dimension_cache const *c)
{
Score_element *s = dynamic_cast<Score_element*>(c->element_l());
- Molecule*m = s->do_brew_molecule_p();
-
- Interval iv = m->extent()[c->axis ()];
-
- delete m;
- return iv;
+ Molecule m = s->do_brew_molecule();
+ return m.extent()[c->axis ()];
}
if (to_boolean (get_elt_property ("transparent")))
return;
- // we're being silly here.
- if (output_p_)
- delete output_p_;
- output_p_ = do_brew_molecule_p ();
+ Molecule m (do_brew_molecule ());
Offset o (relative_coordinate (0, X_AXIS), relative_coordinate (0, Y_AXIS));
SCM s = get_elt_property ("extra-offset");
o[Y_AXIS] += il * gh_scm2double (gh_cdr (s));
}
- pscore_l_->outputter_l_->output_molecule (output_p_,
- o,
- classname(this));
-
- delete output_p_;
- output_p_ =0;
+ pscore_l_->outputter_l_->output_molecule (m.expr_, o, classname(this));
}
/*
-Molecule*
-Score_element::do_brew_molecule_p() const
+Molecule
+Score_element::do_brew_molecule() const
{
SCM glyph = get_elt_property ("glyph");
if (gh_string_p (glyph))
{
- Molecule*output = new Molecule (lookup_l ()->afm_find (String (ly_scm2string (glyph))));
+ return lookup_l ()->afm_find (String (ly_scm2string (glyph)));
- return output;
}
else
{
Interval emp;
emp.set_empty ();
- Molecule a (lookup_l ()->fill (Box (emp,emp)));
- return new Molecule (a);
+ return lookup_l ()->fill (Box (emp,emp));
}
}
#include "ly-smobs.icc"
-IMPLEMENT_SMOBS(Score_element);
IMPLEMENT_UNSMOB(Score_element, element);
+IMPLEMENT_SMOBS(Score_element);
SCM
Score_element::mark_smob (SCM ses)
{
i.set_direction (d);
}
-Molecule*
-Script::do_brew_molecule_p () const
+Molecule
+Script::do_brew_molecule () const
{
Direction dir = DOWN;
SCM d = get_elt_property ("direction");
if (isdir_b (d))
dir = to_dir (d);
- return new Molecule (get_molecule (dir));
+ return get_molecule (dir);
}
return s->get_spanned_interval ();
}
-Molecule*
-Span_bar::do_brew_molecule_p () const
+Molecule
+Span_bar::do_brew_molecule () const
{
Interval iv (get_spanned_interval ());
- Molecule*output = new Molecule;
+ Molecule output;
SCM s = get_elt_property ("glyph");
if (gh_string_p (s) && !iv.empty_b())
{
- output->add_molecule (lookup_l ()->bar (ly_scm2string (s),
+ output.add_molecule (lookup_l ()->bar (ly_scm2string (s),
iv.length (),
paper_l ()));
}
-Molecule*
-Staff_symbol::do_brew_molecule_p() const
+Molecule
+Staff_symbol::do_brew_molecule() const
{
Score_element * common
= spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS);
;
Real t = paper_l ()->get_var ("stafflinethickness");
- Molecule rule = lookup_l ()->filledbox (Box (Interval (0,width),
- Interval (-t/2, t/2)));
-
int l = line_count ();
Real height = (l-1) * staff_space () /2;
- Molecule * m = new Molecule;
+ Molecule m;
for (int i=0; i < l; i++)
{
- Molecule a (rule);
+ Molecule a =
+ lookup_l ()->filledbox (Box (Interval (0,width),
+ Interval (-t/2, t/2)));
+
a.translate_axis (height - i * staff_space (), Y_AXIS);
- m->add_molecule (a);
+ m.add_molecule (a);
}
return m;
}
-Molecule*
-Stem_tremolo::do_brew_molecule_p () const
+Molecule
+Stem_tremolo::do_brew_molecule () const
{
Stem * st = stem_l ();
int mult =0;
abbrev_flags = gh_scm2int (a);
}
- Molecule *beams= new Molecule;
+ Molecule mol;
for (int i = 0; i < abbrev_flags; i++)
{
Molecule b (a);
b.translate_axis (interbeam_f * i, Y_AXIS);
- beams->add_molecule (b);
+ mol.add_molecule (b);
}
- beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
+ mol.translate_axis (-mol.extent ()[Y_AXIS].center (), Y_AXIS);
if (st)
{
if (st->beam_l ())
{
- beams->translate (Offset(st->hpos_f () - hpos_f (),
+ mol.translate (Offset(st->hpos_f () - hpos_f (),
st->stem_end_position () * half_staff_space -
directional_element (st->beam_l ()).get () * beams_i * interbeam_f));
}
/*
Beams should intersect one beamthickness below staff end
*/
- Real dy = - beams->extent ()[Y_AXIS].length () / 2 * st->get_direction ();
+ Real dy = - mol.extent ()[Y_AXIS].length () / 2 * st->get_direction ();
/*
uhg. Should use relative coords and placement
: 0.0;
dy += st->stem_end_position ();
- beams->translate (Offset(st->hpos_f () - hpos_f ()+
+ mol.translate (Offset(st->hpos_f () - hpos_f ()+
whole_note_correction, dy));
}
*/
}
- return beams;
+ return mol;
}
const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh!
-Molecule*
-Stem::do_brew_molecule_p () const
+Molecule
+Stem::do_brew_molecule () const
{
- Molecule *mol_p =new Molecule;
+ Molecule mol;
Staff_symbol_referencer_interface si (first_head ());
Real stem_width = paper_l ()->get_var ("stemthickness");
Molecule ss =lookup_l ()->filledbox (Box (Interval (-stem_width/2, stem_width/2),
Interval (stem_y[DOWN]*dy, stem_y[UP]*dy)));
- mol_p->add_molecule (ss);
+ mol.add_molecule (ss);
}
if (!beam_l () && abs (flag_i ()) > 2)
{
Molecule fl = flag ();
fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS);
- mol_p->add_molecule (fl);
+ mol.add_molecule (fl);
}
- return mol_p;
+ return mol;
}
Real
#include "paper-def.hh"
#include "lookup.hh"
-Molecule*
-Text_item::do_brew_molecule_p () const
+Molecule
+Text_item::do_brew_molecule () const
{
SCM style = get_elt_property ("style");
String st = gh_string_p (style) ? ly_scm2string (style) : "";
SCM txt = get_elt_property ("text");
String t = gh_string_p (txt) ? ly_scm2string (txt) : "";
- Molecule a= paper_l ()->lookup_l(0)->text (st, t, paper_l ());
-
- return new Molecule (a);
+ return paper_l ()->lookup_l(0)->text (st, t, paper_l ());
}
}
// ugh.!
-Molecule*
-Time_signature::do_brew_molecule_p () const
+Molecule
+Time_signature::do_brew_molecule () const
{
SCM st = get_elt_property ("style");
String style (ly_scm2string (st));
if (style[0]=='1')
{
- return new Molecule (time_signature (n, 0));
+ return time_signature (n, 0);
}
else
{
- return new Molecule (special_time_signature (style, n, d));
+ return special_time_signature (style, n, d);
}
}
else
- return new Molecule (time_signature (n,d));
+ return time_signature (n,d);
}
Molecule
/*
TODO.
*/
-Molecule*
-Tuplet_spanner::do_brew_molecule_p () const
+Molecule
+Tuplet_spanner::do_brew_molecule () const
{
- Molecule* mol_p = new Molecule;
+ Molecule mol;
// Default behaviour: number always, bracket when no beam!
bool par_beam = to_boolean (get_elt_property ("parallel-beam"));
num.translate_axis (dy/2, Y_AXIS);
- mol_p->add_molecule (num);
+ mol.add_molecule (num);
}
Real thick = paper_l ()->get_var ("tuplet_thick");
gh_int2scm (dir),
SCM_UNDEFINED);
- mol_p->add_atom (at);
+ Box b;
+ mol.add_molecule (Molecule (b, at));
}
- mol_p->translate_axis (dir * staff_space, Y_AXIS);
+ mol.translate_axis (dir * staff_space, Y_AXIS);
}
- return mol_p;
+ return mol;
}
void
/*
FIXME: too complicated.
*/
-Molecule*
-Volta_spanner::do_brew_molecule_p () const
+Molecule
+Volta_spanner::do_brew_molecule () const
{
- Molecule* mol_p = new Molecule;
+ Molecule mol;
Link_array<Bar> bar_arr
= Group_interface__extract_elements (this, (Bar*)0, "bars");
if (!bar_arr.size ())
- return mol_p;
+ return mol;
Link_array<Score_element> note_column_arr
= Group_interface__extract_elements (this, (Score_element*)0, "note-columns");
Real w = spanner_length() - dx - get_broken_left_end_align ();
Real h = paper_l()->get_var ("volta_spanner_height");
- Molecule volta;
-
SCM at = (gh_list (ly_symbol2scm ("volta"),
gh_double2scm (h),
gh_double2scm (w),
gh_int2scm (no_vertical_start),
gh_int2scm (no_vertical_end),
SCM_UNDEFINED));
-
- volta.dim_[Y_AXIS] = Interval (- h/2, h/2);
- volta.dim_[X_AXIS] = Interval (0, w);
- volta.add_atom (at);
+ Box b (Interval (- h/2, h/2), Interval (0, w));
+ Molecule volta(b,at);
Molecule num (lookup_l ()->text ("volta",
ly_scm2string (get_elt_property("text")),
Offset off (num.dim_.x ().length () + gap,
h / half_staff_space - gap);
num.translate (off);
- mol_p->add_molecule (volta);
- mol_p->add_molecule (num);
- mol_p->translate (Offset (0, dy));
- return mol_p;
+ mol.add_molecule (volta);
+ mol.add_molecule (num);
+ mol.translate (Offset (0, dy));
+ return mol;
}
void
slur_y_free = 0.75 * \staffspace;
slur_x_minimum = 1.5 * \staffspace;
+
+% use tangent controls or area asymmetry?
+bezier_area = 1.0;
+bezier_asymmetry = 1.0;
+bezier_beautiful = 2.0;
+
+% The constants that define the valid areas for the middle control points
+% Used in de_uglyfy. Bit empirical.
+bezier_control1 = 1.5;
+bezier_control2 = 0.8;
+bezier_control3 = -2.0;
+
+% URG: the magic constants for area asymmetry
+bezier_pct_c0 = -0.2;
+bezier_pct_c3 = 0.000006;
+bezier_pct_out_max = 0.8;
+bezier_pct_in_max = 1.2;
+bezier_area_steps = 1.0;
+
+bezier_before_blowfit = 0.5;
+
%{
Like beams, slurs often aren't as steep as the notes they encompass.
This sets the amount of damping.
Comment (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ Comment Thanks go to out to participants in discussions on
+ Comment alt.ascii-art and rec.music.compose
+
+ Comment noteheads-0 by llizard/ejm <llizard_ejm@yahoo.com>
+ Comment and Shaun Mead <shaun.mead@ns.sympatico.ca>
+
Comment Lines that start with TAB or FF make up the .afm
Comment TABs are comments
Comment `Comment' is the afm comment prefix
Comment part of LilyPond's [ascii music font]
Comment (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ Comment Thanks go to out to participants in discussions on
+ Comment alt.ascii-art and rec.music.compose
+
+ Comment first noteheads-2 (although erroneously named) by
+ Comment Wesley Clifford <parallax@apk.net>
+ Comment rests-2 by Ben Norwood <bdn95@aber.ac.uk>
+ Comment accidentals--1 and suggestions for noteheads by
+ Comment Ben Norwood <bdn95@aber.ac.uk>
+
Comment Lines that start with TAB or FF make up the .afm
Comment TABs are comments
*os_p_ << filename_str_g;
*os_p_ << "\n\n";
// ugh
- *os_p_ << "\\version \"1.2.7\";\n";
+ *os_p_ << "\\version \"1.3.4\";\n";
}
void