not compute anything, but a side effect of a->do_side_processing ()
is that the elements are placed correctly. */
Real
-Align_interface::alignment_callback (Score_element const *sc, Axis ax)
+Align_interface::alignment_callback (Score_element *sc, Axis ax)
{
Score_element * par = sc->parent_l (ax);
if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED)
Real
-Align_interface::center_on_element (Score_element const *me, Axis a)
+Align_interface::center_on_element (Score_element *me, Axis a)
{
Score_element *cent = unsmob_element (me->get_elt_pointer ("group-center-element"));
#include "grace-align-item.hh"
#include "align-interface.hh"
#include "note-column.hh"
-#include "local-key-item.hh"
#include "warn.hh"
#include "directional-element-interface.hh"
#include "side-position-interface.hh"
{
Grace_align_item * align_item_p_;
Note_column * now_column_l_;
- Local_key_item * accidental_l_;
+ Score_element * accidental_l_;
virtual void process_acknowledged ();
virtual void do_post_move_processing ();
{
now_column_l_ =n;
}
- else if (Local_key_item * it = dynamic_cast<Local_key_item*> (inf.elem_l_))
+ else if (to_boolean (inf.elem_l_->get_elt_property ("accidentals-interface")))
{
- accidental_l_ = it;
+ accidental_l_ = inf.elem_l_;
}
}
void
#include "beaming.hh"
#include "auto-beam-engraver.hh"
#include "musical-request.hh"
-#include "bar.hh"
#include "beam.hh"
-#include "rest.hh"
#include "stem.hh"
#include "debug.hh"
#include "timing-engraver.hh"
{
end_beam ();
}
- else if (Bar *b = dynamic_cast<Bar *> (info.elem_l_))
+ else if (to_boolean (info.elem_l_->get_elt_property ("bar-interface")))
{
end_beam ();
}
}
Interval
-Axis_group_interface::group_extent_callback (Score_element const*me, Axis a)
+Axis_group_interface::group_extent_callback (Score_element *me, Axis a)
{
Score_element * common =(Score_element*) me;
rest -> stem -> beam -> interpolate_y_position ()
*/
Real
-Beam::rest_collision_callback (Score_element const *rest, Axis a )
+Beam::rest_collision_callback (Score_element *rest, Axis a )
{
assert (a == Y_AXIS);
#include "side-position-interface.hh"
#include "warn.hh"
-#include "dimension-cache.hh"
#include "lily-guile.hh"
#include "break-align-item.hh"
#include "dimensions.hh"
-#include "paper-score.hh"
#include "paper-def.hh"
#include "paper-column.hh"
+
#include "group-interface.hh"
#include "align-interface.hh"
private:
Breathing_sign_req * breathing_sign_req_l_;
- Breathing_sign * breathing_sign_p_;
+ Score_element * breathing_sign_p_;
};
Breathing_sign_engraver::Breathing_sign_engraver()
if(breathing_sign_req_l_)
{
SCM b = get_property ("basicBreathingSignProperties");
- breathing_sign_p_ = new Breathing_sign (b);
- Staff_symbol_referencer_interface st (breathing_sign_p_);
- st.set_interface ();
+ breathing_sign_p_ = new Item (b);
+
+ Breathing_sign::set_interface (breathing_sign_p_);
announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_));
}
#include "direction.hh"
-Breathing_sign::Breathing_sign (SCM s)
- : Item (s)
-{
-}
-
-
MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Breathing_sign,brew_molecule);
return sc->lookup_l()->filledbox(b).create_scheme ();
}
-GLUE_SCORE_ELEMENT(Breathing_sign,after_line_breaking);
-SCM
-Breathing_sign::member_after_line_breaking ()
+Real
+Breathing_sign::offset_callback (Score_element * b, Axis a)
{
- Real space = Staff_symbol_referencer_interface (this).staff_space();
- Direction d = Directional_element_interface (this). get ();
+ Score_element * me = (Score_element*)b;
+
+ Real space = Staff_symbol_referencer_interface (b).staff_space();
+ Direction d = Directional_element_interface (b). get ();
if (!d)
{
d = UP;
- Directional_element_interface (this).set (d);
+ Directional_element_interface (me).set (d);
}
- translate_axis(2.0 * space * d, Y_AXIS);
-
- return SCM_UNDEFINED;
+ return 2.0 * space * d;
}
+void
+Breathing_sign::set_interface (Score_element *b)
+{
+ Staff_symbol_referencer_interface::set_interface (b);
+ b->add_offset_callback (Breathing_sign::offset_callback,Y_AXIS);
+}
(c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "chord-name-engraver.hh"
+#include "engraver.hh"
#include "chord-name.hh"
+#include "chord.hh"
#include "musical-request.hh"
#include "paper-def.hh"
#include "lookup.hh"
#include "main.hh"
#include "dimensions.hh"
#include "item.hh"
+#include "musical-pitch.hh"
+class Chord_name_engraver : public Engraver
+{
+public:
+ Chord_name_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
+
+protected:
+ virtual void do_pre_move_processing ();
+ virtual void acknowledge_element (Score_element_info i);
+ virtual void do_process_music ();
+ virtual bool do_try_music (Music* m);
+
+private:
+ Array<Musical_pitch> pitch_arr_;
+ Item* chord_name_p_;
+ Tonic_req* tonic_req_;
+ Inversion_req* inversion_req_;
+ Bass_req* bass_req_;
+};
ADD_THIS_TRANSLATOR (Chord_name_engraver);
if (gh_boolean_p (chord_inversion))
find_inversion_b = gh_scm2bool (chord_inversion);
- chord_name_p_ = new Chord_name (get_property ("basicChordNameProperties"));
+ chord_name_p_ = new Item (get_property ("basicChordNameProperties"));
Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_,
find_inversion_b);
*/
#include "chord-name.hh"
-#include "musical-request.hh"
-#include "warn.hh"
-#include "debug.hh"
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
-#include "staff-symbol-referencer.hh"
-
+#include "score-element.hh"
/*
TODO: move text lookup out of Chord_name
*/
Molecule
-Chord_name::ly_word2molecule (SCM word, Real* x) const
+Chord_name::ly_word2molecule (Score_element * me, SCM word, Real* x)
{
*x = 0;
/*
UGH. Should read from font metric structure.
*/
- Real ex = lookup_l ()->text ("", "x",
- paper_l ()).extent (Y_AXIS).length ();
- Real em = lookup_l ()->text ("", "m",
- paper_l ()).extent (X_AXIS).length ();
+ Real ex = me->lookup_l ()->text ("", "x",
+ me->paper_l ()).extent (Y_AXIS).length ();
+ Real em = me->lookup_l ()->text ("", "m",
+ me->paper_l ()).extent (X_AXIS).length ();
String w = ly_scm2string (word);
Molecule mol;
s = scm_assoc (ly_symbol2scm ("font"), options_alist);
if (s != SCM_BOOL_F && ly_scm2string (gh_cdr (s)) == "feta")
- mol = paper_l ()->lookup_l (size)->afm_find (w);
+ mol = me->paper_l ()->lookup_l (size)->afm_find (w);
else
- mol = paper_l ()->lookup_l (size)->text (style, w, paper_l ());
+ mol = me->paper_l ()->lookup_l (size)->text (style, w, me->paper_l ());
mol.translate (offset);
return mol;
;; property: align, kern, font (?), size
*/
Molecule
-Chord_name::ly_text2molecule (SCM text) const
+Chord_name::ly_text2molecule (Score_element * me, SCM text)
{
Molecule mol;
if (gh_list_p (text))
while (gh_cdr (text) != SCM_EOL)
{
Real x;
- Molecule m = ly_word2molecule (gh_car (text), &x);
+ Molecule m = ly_word2molecule (me, gh_car (text), &x);
if (!m.empty_b ())
mol.add_at_edge (X_AXIS, RIGHT, m, x);
text = gh_cdr (text);
text = gh_car (text);
}
Real x;
- Molecule m = ly_word2molecule (text, &x);
+ Molecule m = ly_word2molecule (me,text, &x);
if (!m.empty_b ())
mol.add_at_edge (X_AXIS, RIGHT, m, x);
return mol;
ly_quote_scm (gh_cons (inversion, bass)),
SCM_UNDEFINED));
- return dynamic_cast<Chord_name*> (sc)->
- ly_text2molecule (text).create_scheme ();
-}
-
-Chord_name::Chord_name (SCM s)
- : Item (s)
-{
+ return ly_text2molecule (sc, text).create_scheme ();
}
#include <ctype.h>
#include "staff-symbol-referencer.hh"
-#include "bar.hh"
-
#include "debug.hh"
#include "command-request.hh"
-#include "timing-translator.hh"
-#include "rhythmic-head.hh"
-#include "key-item.hh"
-#include "local-key-item.hh"
#include "array.hh"
#include "engraver.hh"
#include "direction.hh"
void
Clef_engraver::acknowledge_element (Score_element_info info)
{
- if (dynamic_cast<Bar*>(info.elem_l_)
- && gh_string_p (clef_glyph_))
- create_clef();
-
- Item * it_l =dynamic_cast <Item *> (info.elem_l_);
- if (it_l)
+ Item * item =dynamic_cast <Item *> (info.elem_l_);
+ if (item)
{
- if (to_boolean (it_l->get_elt_property("note-head-interface"))
- || dynamic_cast<Local_key_item*> (it_l))
+ if (to_boolean (info.elem_l_->get_elt_property ("bar-interface"))
+ && gh_string_p (clef_glyph_))
+ create_clef();
+
+
+ if (to_boolean (item->get_elt_property("note-head-interface"))
+ || to_boolean (item->get_elt_property ("accidentals-interface")))
{
- Staff_symbol_referencer_interface si (it_l);
+ Staff_symbol_referencer_interface si (item);
si.set_position (int (si.position_f ()) + c0_position_i_);
}
- else if (Key_item *k = dynamic_cast<Key_item*>(it_l))
+ else if (to_boolean (item->get_elt_property ("key-item-interface")))
{
- k->set_elt_property ("c0-position", gh_int2scm (c0_position_i_));
+ item->set_elt_property ("c0-position", gh_int2scm (c0_position_i_));
}
}
}
Item *c= new Item ( current_settings_);
announce_element (Score_element_info (c, clef_req_l_));
- Staff_symbol_referencer_interface si(c);
- si.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (c);
clef_p_ = c;
}
}
Real
-Collision::force_shift_callback (Score_element const * c, Axis a)
+Collision::force_shift_callback (Score_element * c, Axis a)
{
assert (a == X_AXIS);
*/
-#include "dot-column-engraver.hh"
+
#include "rhythmic-head.hh"
#include "dot-column.hh"
#include "side-position-interface.hh"
+#include "engraver.hh"
+
+class Dot_column_engraver : public Engraver
+{
+ Score_element *dotcol_p_ ;
+ Link_array<Rhythmic_head> head_l_arr_;
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Dot_column_engraver();
+
+protected:
+ virtual void acknowledge_element (Score_element_info);
+ virtual void do_pre_move_processing ();
+};
+
Dot_column_engraver::Dot_column_engraver ()
{
void
Dot_column_engraver::acknowledge_element (Score_element_info info)
{
- Rhythmic_head * h = dynamic_cast<Rhythmic_head*>(info.elem_l_);
- if (!h)
- return;
+ Score_element *d = unsmob_element (info.elem_l_->get_elt_pointer ("dot"));
+ if (d)
+ {
+ if (!dotcol_p_)
+ {
+ dotcol_p_ = new Item(get_property ("basicDotColumnProperties"));
- if (!h->dots_l ())
- return;
+ Dot_column::set_interface (dotcol_p_);
+ Side_position_interface (dotcol_p_).set_axis (X_AXIS);
+ Side_position_interface (dotcol_p_).set_direction (RIGHT);
+ announce_element (Score_element_info (dotcol_p_, 0));
+ }
- if (!dotcol_p_)
- {
- dotcol_p_ = new Dot_column(get_property ("basicDotColumnProperties"));
- Side_position_interface (dotcol_p_).set_axis (X_AXIS);
- Side_position_interface (dotcol_p_).set_direction (RIGHT);
- announce_element (Score_element_info (dotcol_p_, 0));
+ Dot_column::add_head (dotcol_p_, info.elem_l_);
}
-
- dotcol_p_->add_head (h);
}
void
-Dot_column::add_head (Rhythmic_head *r)
+Dot_column::add_head (Score_element * dc, Score_element *rh)
{
- if (!r->dots_l ())
- return ;
-
- Side_position_interface (this).add_support (r);
- Item * d = r->dots_l ();
+ Score_element * d = unsmob_element (rh->get_elt_pointer ("dot"));
if (d)
{
- Pointer_group_interface gi (this, "dots");
+ Side_position_interface (dc).add_support (rh);
+
+ Pointer_group_interface gi (dc, "dots");
gi.add_element (d);
d->add_offset_callback (force_shift_callback , Y_AXIS);
- Axis_group_interface (this).add_element (d);
+ Axis_group_interface (dc).add_element (d);
}
}
}
-Dot_column::Dot_column (SCM s)
- : Item (s)
+void
+Dot_column::set_interface (Score_element* dc)
{
- this->set_elt_pointer ("dots", SCM_EOL);
- Directional_element_interface (this).set (RIGHT);
+ dc->set_elt_pointer ("dots", SCM_EOL);
+ Directional_element_interface (dc).set (RIGHT);
- Axis_group_interface (this).set_interface ();
- Axis_group_interface (this).set_axes(X_AXIS,X_AXIS);
+ Axis_group_interface (dc).set_interface ();
+ Axis_group_interface (dc).set_axes(X_AXIS,X_AXIS);
}
/*
Real
-Dot_column::force_shift_callback (Score_element const * dot, Axis a)
+Dot_column::force_shift_callback (Score_element * dot, Axis a)
{
assert (a == Y_AXIS);
Score_element * me = dot->parent_l (X_AXIS);
Real
-Dots::quantised_position_callback (Score_element const* me, Axis a)
+Dots::quantised_position_callback (Score_element * me, Axis a)
{
assert (a == Y_AXIS);
Score_element * elt_l_;
Align_interface (Score_element const*);
- static Real alignment_callback (Score_element const*,Axis);
+ static Real alignment_callback (Score_element *,Axis);
void do_side_processing (Axis a);
void set_axis (Axis);
Axis axis () const;
int get_count (Score_element*)const;
void set_interface ();
bool has_interface_b ();
- static Real center_on_element (Score_element const *c, Axis);
+ static Real center_on_element (Score_element *c, Axis);
};
#endif /* ALIGN_INTERFACE_HH */
Score_element *elt_l_;
Axis_group_interface (Score_element*);
- static Interval group_extent_callback (Score_element const*,Axis);
+ static Interval group_extent_callback (Score_element *,Axis);
static Interval relative_group_extent (Axis, Score_element * common, SCM list);
void add_element (Score_element*);
int visible_stem_count () const;
Stem* first_visible_stem () const;
Stem* last_visible_stem () const;
- static Real rest_collision_callback (Score_element const*,Axis);
+ static Real rest_collision_callback (Score_element *,Axis);
Beam (SCM);
void add_stem (Stem*);
void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
#ifndef BREATHING_SIGN_HH
#define BREATHING_SIGN_HH
-#include "item.hh"
-#include "parray.hh"
+#include "lily-guile.hh"
/*
breathing sign (apostrophe within staff, not the comma above staff
type)
*/
-class Breathing_sign : public Item
+class Breathing_sign
{
public:
static SCM brew_molecule (SCM);
-
- VIRTUAL_COPY_CONS(Score_element);
- Breathing_sign (SCM s);
-public:
- SCM member_after_line_breaking ();
- static SCM after_line_breaking (SCM);
- SCM member_brew_molecule () const;
+ static Real offset_callback (Score_element *, Axis);
+ static void set_interface (Score_element*);
};
#endif // BREATHING_SIGN_HH
#ifndef CHORD_NAME_HH
#define CHORD_NAME_HH
-#include "chord.hh"
-#include "item.hh"
+#include "lily-guile.hh"
#include "molecule.hh"
/**
inversion(optional): musical-pitch
bass(optional): musical-pitch
*/
-class Chord_name : public Item
+class Chord_name
{
public:
static SCM brew_molecule (SCM);
-
- VIRTUAL_COPY_CONS (Score_element);
- Molecule ly_word2molecule (SCM scm, Real* x) const;
- Molecule ly_text2molecule (SCM scm) const;
- Chord_name(SCM s);
-public:
- SCM member_brew_molecule () const;
-
+ static Molecule ly_word2molecule (Score_element*, SCM scm, Real* x) ;
+ static Molecule ly_text2molecule (Score_element*, SCM scm) ;
};
#endif // CHORD_NAME_HH
Score_element* elt_l_;
static SCM automatic_shift (Score_element*);
static SCM forced_shift (Score_element*);
- static Real force_shift_callback (Score_element const*, Axis);
+ static Real force_shift_callback (Score_element *, Axis);
static void do_shifts (Score_element*);
void add_column (Note_column*ncol_l);
#define DIMENSION_CACHE_CALLBACK_HH
-typedef Interval (*Dim_cache_callback)(Score_element const *,Axis);
-typedef Real (*Offset_callback)(Score_element const *,Axis);
+typedef Interval (*Dim_cache_callback)(Score_element *,Axis);
+typedef Real (*Offset_callback)(Score_element *,Axis);
#endif /* DIMENSION_CACHE_CALLBACK_HH */
#ifndef DOT_COLUMN_HH
#define DOT_COLUMN_HH
-#include "item.hh"
-
+#include "lily-guile.hh"
/**
Group dots. This is needed because, the dots have to be aligned per voice
*/
-class Dot_column : public Item
+class Dot_column // interface
{
- static int compare (Score_element * const&,Score_element * const&);
public:
- VIRTUAL_COPY_CONS (Score_element);
- void add_head (Rhythmic_head*);
- Dot_column (SCM);
-
- static Real force_shift_callback (Score_element const* , Axis);
+ static int compare (Score_element * const&,Score_element * const&);
+ static void add_head (Score_element * dotcol, Score_element* rh );
+ static void set_interface (Score_element*);
+ static Real force_shift_callback (Score_element * , Axis);
static SCM do_shifts (SCM dotlist);
};
#endif // DOT_COLUMN_HH
class Dots // interface
{
public:
- static Real quantised_position_callback(Score_element const*, Axis);
+ static Real quantised_position_callback(Score_element*, Axis);
static SCM brew_molecule (SCM);
};
#ifndef KEYITEM_HH
#define KEYITEM_HH
-#include "item.hh"
-#include "array.hh"
-
+#include "lily-guile.hh"
+#include "lily-proto.hh"
/**
A group of accidentals.
new-accidentals -- list of (pitch, accidental) pairs
*/
-class Key_item :public Item
+struct Key_item
{
- int calculate_position(SCM pair) const;
-
-public:
- VIRTUAL_COPY_CONS(Score_element);
- Key_item (SCM);
+ static int calculate_position(Score_element*,SCM pair) ;
+ void set_interface (Score_element*);
static SCM brew_molecule (SCM);
-
-
-
- SCM member_brew_molecule() const;
};
#endif // KEYITEM_HH
#ifndef LOCALKEYITEM_HH
#define LOCALKEYITEM_HH
+
+
#include "item.hh"
#include "array.hh"
#include "musical-pitch.hh"
Rest_collision(Score_element*);
void set_interface ();
- static Real force_shift_callback (Score_element const*, Axis);
+ static Real force_shift_callback (Score_element *, Axis);
static SCM do_shift (Score_element*,SCM);
};
#endif // REST_COLLISION_HH
#include "smobs.hh"
#include "dimension-cache.hh"
-typedef Interval (*Extent_callback)(Score_element const *,Axis);
-typedef Real (*Offset_callback)(Score_element const *,Axis);
+typedef Interval (*Extent_callback)(Score_element *,Axis);
+typedef Real (*Offset_callback)(Score_element *,Axis);
#define READONLY_PROPS // FIXME.
Molecule get_molecule () const;
void suicide ();
- static Interval preset_extent (Score_element const*,Axis);
- static Interval point_dimension_callback (Score_element const*,Axis );
- static Interval molecule_extent (Score_element const*,Axis);
+ static Interval preset_extent (Score_element *,Axis);
+ static Interval point_dimension_callback (Score_element *,Axis );
+ static Interval molecule_extent (Score_element *,Axis);
protected:
/**
#ifndef Script_COLUMN_HH
#define Script_COLUMN_HH
-#include "item.hh"
+#include "lily-guile.hh"
+#include "lily-proto.hh"
-class Script_column : public Item
+class Script_column
{
public:
- Script_column(SCM);
- void add_staff_sided (Item*);
-
- SCM member_before_line_breaking ();
+ static void add_staff_sided (Score_element*, Item*);
static SCM before_line_breaking (SCM);
};
*/
class Script : public Item
{
- Molecule get_molecule (Direction d) const;
public:
+ static Molecule get_molecule (Score_element*,Direction d);
Script (SCM);
- static SCM brew_molecule (SCM);
-
-
-
- SCM member_before_line_breaking ();
- static SCM before_line_breaking (SCM);
+ static SCM brew_molecule (SCM);
SCM member_after_line_breaking ();
static SCM after_line_breaking (SCM);
- SCM member_brew_molecule () const;
};
#endif /* Stem_SCRIPT_HH */
class Separating_group_spanner : public Spanner
{
public:
- void add_spacing_unit (Single_malt_grouping_item*);
+ void add_spacing_unit (Item*);
Separating_group_spanner(SCM);
protected:
VIRTUAL_COPY_CONS(Score_element);
#ifndef SEPARATING_LINE_GROUP_GRAV_HH
#define SEPARATING_LINE_GROUP_GRAV_HH
-
-#include "engraver.hh"
-
-class Separating_line_group_engraver : public Engraver
-{
-protected:
- Single_malt_grouping_item * break_malt_p_;
- Single_malt_grouping_item* nobreak_malt_p_;
- Separating_group_spanner * sep_span_p_;
-
- virtual void acknowledge_element (Score_element_info);
- virtual void do_creation_processing ();
- virtual void do_removal_processing ();
- virtual void do_pre_move_processing ();
-public:
- Separating_line_group_engraver ();
- VIRTUAL_COPY_CONS (Translator);
-
-};
-
-
#endif /* SEPARATING_LINE_GROUP_GRAV_HH */
--- /dev/null
+/*
+ single-malt-grouping-item.hh -- declare Separation_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef SINGLE_MALT_GROUPING_ITEM_HH
+#define SINGLE_MALT_GROUPING_ITEM_HH
+
+#include "lily-proto.hh"
+
+/** Calc dimensions for the Separating_group_spanner; this has to be
+ an item to get dependencies correct. It can't be an element_group
+ since these usually are in a different X_group
+
+ Properties:
+
+
+ elements -- list of items.
+
+ no-spacing-rods -- read from elements: boolean that makes Separation_item ignore
+ this item
+
+*/
+struct Separation_item
+{
+ static void set_interface (Score_element*);
+ static Interval my_width (Score_element*) ;
+ static void add_item (Score_element*,Item*);
+};
+
+#endif /* SINGLE_MALT_GROUPING_ITEM_HH */
+
Score_element * elt_l_;
public:
Side_position_interface (Score_element const*);
- static Real side_position (Score_element const *, Axis);
- static Real aligned_on_self (Score_element const *, Axis);
- static Real aligned_side (Score_element const *, Axis);
- static Real quantised_position (Score_element const*, Axis);
- static Real centered_on_parent (Score_element const*, Axis);
+ static Real side_position (Score_element *, Axis);
+ static Real aligned_on_self (Score_element *, Axis);
+ static Real aligned_side (Score_element *, Axis);
+ static Real quantised_position (Score_element *, Axis);
+ static Real centered_on_parent (Score_element *, Axis);
void set_axis (Axis);
void set_minimum_space (Real);
void set_padding (Real);
void add_bar (Score_element*);
void evaluate_empty ();
- static Interval width_callback(Score_element const*, Axis) ;
+ static Interval width_callback(Score_element *, Axis) ;
virtual Real get_bar_size () const;
SCM member_before_line_breaking ();
class Staff_symbol_referencer_interface
{
public:
- Score_element * elt_l_;
+ Score_element * elt_l_; // junkme.
Staff_symbol_referencer_interface (Score_element const*);
- void set_interface ();
- bool has_interface_b ();
+ static void set_interface (Score_element*);
+ static bool has_interface_b (Score_element*);
void set_position (Real);
- static Real callback (Score_element const*, Axis a);
+ static Real callback (Score_element *, Axis a);
/**
Leading are the lead strips between the sticks (lines) of
void position_noteheads();
Real stem_end_position () const;
- static Real off_callback (Score_element const*, Axis);
+ static Real off_callback (Score_element *, Axis);
Molecule flag () const;
SCM member_before_line_breaking ();
static SCM before_line_breaking (SCM);
- static Interval dim_callback (Score_element const*,Axis);
+ static Interval dim_callback (Score_element *,Axis);
SCM member_brew_molecule() const;
void set_spacing_hints () ;
#define METER_HH
#include "item.hh"
-#include "array.hh"
-#include "real.hh"
/**
Print a time_signature sign.
- TODO:
- C style time_signatures, 2+3+2/8 time_signatures, alla breve.
+ TODO:
+
+ 2+3+2/8 time_signatures
*/
-class Time_signature: public Item
+struct Time_signature
{
- Molecule special_time_signature (String,int,int) const;
- Molecule time_signature (int, int)const;
-
-public:
- SCM member_brew_molecule() const;
-
- Time_signature (SCM);
- static SCM brew_molecule (SCM);
-
-
- /*
- TODO: make this SCM!
- */
- Array<int> args_;
-
- VIRTUAL_COPY_CONS(Score_element);
+ static Molecule special_time_signature (Score_element*,String,int,int) ;
+ static Molecule time_signature (Score_element*,int, int);
+ static SCM brew_molecule (SCM);
};
#endif // METER_HH
VIRTUAL_COPY_CONS(Translator);
Key_change_req * keyreq_l_;
- Key_item * item_p_;
- Protected_scm old_accs_;
+ Item * item_p_;
+ Protected_scm old_accs_; // ugh. -> property
protected:
virtual void do_creation_processing();
{
if (!item_p_)
{
- item_p_ = new Key_item ( get_property ("basicKeyProperties"));
-
+ item_p_ = new Item ( get_property ("basicKeyProperties"));
+
item_p_->set_elt_property ("c0-position", gh_int2scm (0));
// todo: put this in basic props.
item_p_->set_elt_property ("old-accidentals", old_accs_);
item_p_->set_elt_property ("new-accidentals", get_property ("keySignature"));
- Staff_symbol_referencer_interface st (item_p_);
- st.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (item_p_);
SCM prop = get_property ("keyOctaviation");
bool multi = to_boolean (prop);
keyplacement by Mats Bengtsson
*/
-#include "group-interface.hh"
+#include "item.hh"
#include "key-item.hh"
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
#include "staff-symbol-referencer.hh"
-Key_item::Key_item (SCM s)
- : Item (s)
-{
- set_elt_property ("c0-position", gh_int2scm (0));
-}
-
-
/*
FIXME: too much hardcoding here.
*/
the thinking to other parties.
*/
int
-Key_item::calculate_position(SCM pair) const
+Key_item::calculate_position(Score_element *ki, SCM pair)
{
int p = gh_scm2int (gh_car (pair));
int a = gh_scm2int (gh_cdr (pair));
-
- if (to_boolean (get_elt_property ("multi-octave")))
+ int c0p = gh_scm2int (ki->get_elt_property ("c0-position"));
+ if (to_boolean (ki->get_elt_property ("multi-octave")))
{
- return p + gh_scm2int (get_elt_property ("c0-position"));
+ return p + c0p;
}
else {
// Find the c in the range -4 through 2
- int from_bottom_pos = gh_scm2int (get_elt_property ("c0-position")) + 4;
+ int from_bottom_pos = c0p + 4;
from_bottom_pos = from_bottom_pos%7;
from_bottom_pos = (from_bottom_pos + 7)%7; // Precaution to get positive.
int c0 = from_bottom_pos - 4;
TODO
- space the `natural' signs wider
*/
-GLUE_SCORE_ELEMENT(Key_item,brew_molecule);
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Key_item,brew_molecule);
SCM
-Key_item::member_brew_molecule () const
+Key_item::brew_molecule (SCM smob)
{
- Molecule mol;
+ Score_element*me =unsmob_element (smob);
- Staff_symbol_referencer_interface si (this);
+
+ Staff_symbol_referencer_interface si (me);
Real inter = si.staff_space ()/2.0;
- SCM newas = get_elt_property ("new-accidentals");
-
+ SCM newas = me->get_elt_property ("new-accidentals");
+ Molecule mol;
/*
SCM lists are stacks, so we work from right to left, ending with
the cancellation signature.
for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s))
{
int a = gh_scm2int (gh_cdar (s));
- Molecule m = lookup_l ()->afm_find ("accidentals-" + to_str (a));
- m.translate_axis (calculate_position(gh_car (s)) * inter, Y_AXIS);
+ Molecule m = me->lookup_l ()->afm_find ("accidentals-" + to_str (a));
+ m.translate_axis (calculate_position(me, gh_car (s)) * inter, Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, m, 0);
}
-
- if (break_status_dir () != RIGHT)
+
+ Item *it = dynamic_cast<Item*> (me) ;
+ if (it->break_status_dir () != RIGHT)
{
- SCM old = get_elt_property ("old-accidentals");
+ SCM old = me->get_elt_property ("old-accidentals");
/*
Add half a space between cancellation and key sig.
Interval x(0, inter);
Interval y(0,0);
- mol.add_at_edge (X_AXIS, LEFT, lookup_l()->blank (Box(x,y)),0);
+ mol.add_at_edge (X_AXIS, LEFT, me->lookup_l()->blank (Box(x,y)),0);
for (; gh_pair_p (old); old = gh_cdr (old))
{
if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old))
{
- Molecule m =lookup_l ()->afm_find ("accidentals-0");
+ Molecule m =me->lookup_l ()->afm_find ("accidentals-0");
- m.translate_axis (calculate_position(gh_car(old)) * inter, Y_AXIS);
+ m.translate_axis (calculate_position (me, gh_car (old)) * inter, Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, m,0);
}
}
}
/**
-TODO: move into Text_item
+TODO: move into Text_item. UGH: paper_l argument shoudl be junked.
*/
Molecule
Lookup::text (String style, String text, Paper_def *paper_l)
#include "dimension-cache.hh"
#include "staff-symbol-referencer.hh"
-
-
/*
build a ledger line for small pieces.
*/
{
Rhythmic_head *note_p = new Rhythmic_head (get_property ("basicNoteHeadProperties"));
- Staff_symbol_referencer_interface si (note_p);
- si.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (note_p);
+
Note_req * note_req_l = note_req_l_arr_[i];
{
Item * d = new Item (get_property ("basicDotsProperties"));
- Staff_symbol_referencer_interface sd (d);
- sd.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (d);
note_p->set_dots (d);
announce_element (Score_element_info (d,0));
dot_p_arr_.push (d);
}
- si.set_position(note_req_l->pitch_.steps ());
+
+ note_p->set_elt_property("staff-position", gh_int2scm (note_req_l->pitch_.steps ()));
Score_element_info itinf (note_p,note_req_l);
announce_element (itinf);
#include "duration.hh"
Real
-Rest_collision::force_shift_callback (Score_element const*them, Axis a)
+Rest_collision::force_shift_callback (Score_element *them, Axis a)
{
assert (a == Y_AXIS);
if (rest_req_l_ && !rest_p_)
{
rest_p_ = new Rhythmic_head (get_property ("basicRestProperties"));
- Staff_symbol_referencer_interface si (rest_p_);
- si.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (rest_p_);
+
rest_p_->set_elt_property ("duration-log",
gh_int2scm (rest_req_l_->duration_.durlog_i_));
{
dot_p_ = new Item (get_property ("basicDotsProperties"));
- Staff_symbol_referencer_interface si (dot_p_);
- si.set_interface ();
+ Staff_symbol_referencer_interface::set_interface (dot_p_);
+
rest_p_->set_dots (dot_p_);
dot_p_->set_parent (rest_p_, Y_AXIS);
Link_array<Slur> grace_slur_endings_;
Stem * stem_l_;
Note_column *ncol_p_;
- Dot_column *dotcol_l_;
+ Score_element *dotcol_l_;
protected:
VIRTUAL_COPY_CONS(Translator);
if (ncol_p_)
{
if (dotcol_l_
- && !dotcol_l_->parent_l(X_AXIS))
+ && !dotcol_l_->parent_l (X_AXIS))
{
ncol_p_->set_dotcol (dotcol_l_);
}
{
rhead_l_arr_.push (r);
}
- else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
+ else if (item
+ && to_boolean (item->get_elt_property ("dot-column-interface")))
{
- dotcol_l_ = d;
+ dotcol_l_ = item;
}
else if (Slur *s = dynamic_cast<Slur*> (i.elem_l_))
{
#include "paper-column.hh"
#include "debug.hh"
#include "dimensions.hh"
-#include "single-malt-grouping-item.hh"
+#include "separation-item.hh"
Rod::Rod ()
Interval
-Score_element::molecule_extent (Score_element const *s, Axis a )
+Score_element::molecule_extent (Score_element *s, Axis a)
{
Molecule m = s->get_molecule ();
return m.extent(a);
}
Interval
-Score_element::preset_extent (Score_element const *s , Axis a )
+Score_element::preset_extent (Score_element *s , Axis a)
{
SCM ext = s->get_elt_property ((a == X_AXIS)
? "extent-X"
Interval
-Score_element::point_dimension_callback (Score_element const* , Axis)
+Score_element::point_dimension_callback (Score_element* , Axis)
{
return Interval (0,0);
}
}
else if (!d->valid_b_)
{
- d->dim_= (*d->extent_callback_l_ ) (this, a);
+ d->dim_= (*d->extent_callback_l_ ) ((Score_element*)this, a);
d->valid_b_ = true;
}
#include "engraver.hh"
#include "script-column.hh"
+#include "item.hh"
#include "side-position-interface.hh"
-#include "dimension-cache.hh"
/**
Find potentially colliding scripts, and put them in a
Script_column, that will fix the collisions. */
class Script_column_engraver : public Engraver
{
- Script_column *scol_p_;
+ Score_element *scol_p_;
Link_array<Item> script_l_arr_;
public:
{
if (!scol_p_ && script_l_arr_.size () > 1)
{
- scol_p_ = new Script_column (SCM_EOL);
+ scol_p_ = new Item (get_property ("basicScriptColumnProperties"));
+ scol_p_->set_elt_pointer ("scripts", SCM_EOL);
+
announce_element (Score_element_info (scol_p_, 0));
}
if (scol_p_)
{
for (int i=0; i < script_l_arr_.size (); i++)
- scol_p_->add_staff_sided (script_l_arr_[i]);
+ Script_column::add_staff_sided (scol_p_, script_l_arr_[i]);
script_l_arr_.clear ();
}
}
#include "group-interface.hh"
void
-Script_column::add_staff_sided (Item *i)
+Script_column::add_staff_sided (Score_element *me, Item *i)
{
SCM p = i->get_elt_property ("script-priority");
if (!gh_number_p (p))
return;
-
- Pointer_group_interface gi (this, "scripts");
+ Pointer_group_interface gi (me, "scripts");
gi.add_element (i);
- add_dependency (i);
-}
-
-Script_column::Script_column (SCM s)
- : Item (s)
-{
- set_elt_pointer ("scripts", SCM_EOL);
+ me->add_dependency (i);
}
static int
-staff_side_compare (Item * const &i1,
- Item * const &i2)
+staff_side_compare (Score_element * const &i1,
+ Score_element * const &i2)
{
SCM p1 = i1->get_elt_property ("script-priority");
SCM p2 = i2->get_elt_property ("script-priority");
return gh_scm2int (p1) - gh_scm2int (p2);
}
-GLUE_SCORE_ELEMENT(Script_column,before_line_breaking);
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Script_column,before_line_breaking);
+
SCM
-Script_column::member_before_line_breaking ()
+Script_column::before_line_breaking (SCM smob)
{
- Drul_array<Link_array<Item> > arrs;
- Link_array<Item> staff_sided
- = Pointer_group_interface__extract_elements (this, (Item*)0, "scripts");
+ Score_element* me = unsmob_element (smob);
+ Drul_array<Link_array<Score_element> > arrs;
+ Link_array<Score_element> staff_sided
+ = Pointer_group_interface__extract_elements (me, (Score_element*)0, "scripts");
for (int i=0; i < staff_sided.size (); i++)
Direction d = DOWN;
do {
- Link_array<Item> &arr(arrs[d]);
+ Link_array<Score_element> &arr(arrs[d]);
arr.sort (staff_side_compare);
- Item * last = 0;
+ Score_element * last = 0;
for (int i=0; i < arr.size (); i++)
{
Side_position_interface s (arr[i]);
}
// todo -> use result of articulation-to-scriptdef directly as basic prop list.
Script *p =new Script (get_property ("basicScriptProperties"));
+
+ p->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS);
Side_position_interface stafy (p);
}
Molecule
-Script::get_molecule(Direction d) const
+Script::get_molecule(Score_element * me, Direction d)
{
- SCM s = get_elt_property ("molecule");
+ SCM s = me->get_elt_property ("molecule");
assert (gh_pair_p (s));
SCM key = gh_car (s);
if (key == ly_symbol2scm ("feta"))
{
- return lookup_l ()->afm_find ("scripts-" +
+ return me->lookup_l ()->afm_find ("scripts-" +
ly_scm2string (index_cell (gh_cdr (s), d)));
}
else if (key == ly_symbol2scm ("accordion"))
{
- return lookup_l ()->accordion (gh_cdr (s), paper_l()->get_var("interline"));
+ return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("interline"));
}
-
- else assert (false);
+ else
+ assert (false);
return Molecule ();
}
-GLUE_SCORE_ELEMENT(Script,before_line_breaking);
-SCM
-Script::member_before_line_breaking ()
-{
- /*
- center my self on the note head.
- */
- Score_element * e = parent_l(X_AXIS);
- translate_axis (e->extent (X_AXIS).center (), X_AXIS);
- return SCM_UNDEFINED;
-}
GLUE_SCORE_ELEMENT(Script,after_line_breaking);
SCM
}
-GLUE_SCORE_ELEMENT(Script,brew_molecule);
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Script,brew_molecule);
SCM
-Script::member_brew_molecule () const
+Script::brew_molecule (SCM smob)
{
+ Score_element *me= unsmob_element (smob);
Direction dir = DOWN;
- SCM d = get_elt_property ("direction");
+ SCM d = me->get_elt_property ("direction");
if (isdir_b (d))
dir = to_dir (d);
- return get_molecule (dir).create_scheme();
+ return get_molecule (me, dir).create_scheme();
}
*/
#include "separating-group-spanner.hh"
-#include "single-malt-grouping-item.hh"
+#include "separation-item.hh"
#include "paper-column.hh"
#include "paper-def.hh"
#include "dimensions.hh"
#include "group-interface.hh"
static Rod
-make_rod (Single_malt_grouping_item *l, Single_malt_grouping_item *r)
+make_rod (Item *l, Item *r)
{
Rod rod;
- Interval li (l->my_width ());
- Interval ri (r->my_width ());
+ Interval li (Separation_item::my_width (l));
+ Interval ri (Separation_item::my_width (r));
rod.item_l_drul_[LEFT] =l;
rod.item_l_drul_[RIGHT]=r;
SCM elt = gh_cadr (s);
SCM next_elt = gh_car (s);
- Single_malt_grouping_item *l = dynamic_cast<Single_malt_grouping_item*> (unsmob_element (elt));
- Single_malt_grouping_item *r = dynamic_cast<Single_malt_grouping_item*> (unsmob_element ( next_elt));
+ Item *l = dynamic_cast<Item*> (unsmob_element (elt));
+ Item *r = dynamic_cast<Item*> (unsmob_element ( next_elt));
if (!r || !l)
continue;
- Single_malt_grouping_item *lb
- = dynamic_cast<Single_malt_grouping_item*>(l->find_prebroken_piece (RIGHT));
+ Item *lb
+ = dynamic_cast<Item*>(l->find_prebroken_piece (RIGHT));
- Single_malt_grouping_item *rb
- = dynamic_cast<Single_malt_grouping_item*>(r->find_prebroken_piece (LEFT));
+ Item *rb
+ = dynamic_cast<Item*>(r->find_prebroken_piece (LEFT));
a.push (make_rod(l, r));
if (lb)
}
void
-Separating_group_spanner::add_spacing_unit (Single_malt_grouping_item*i)
+Separating_group_spanner::add_spacing_unit (Item*i)
{
Pointer_group_interface (this, "elements").add_element (i);
add_dependency (i);
*/
-#include "separating-line-group-engraver.hh"
#include "separating-group-spanner.hh"
-#include "single-malt-grouping-item.hh"
+#include "separation-item.hh"
#include "paper-column.hh"
#include "paper-def.hh"
+#include "engraver.hh"
+
+class Separating_line_group_engraver : public Engraver
+{
+protected:
+ Item * break_malt_p_;
+ Item * nobreak_malt_p_;
+ Separating_group_spanner * sep_span_p_;
+
+ virtual void acknowledge_element (Score_element_info);
+ virtual void do_creation_processing ();
+ virtual void do_removal_processing ();
+ virtual void do_pre_move_processing ();
+public:
+ Separating_line_group_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
+};
Separating_line_group_engraver::Separating_line_group_engraver ()
{
if (it && !it->parent_l (X_AXIS))
{
bool ib =it->breakable_b ();
- Single_malt_grouping_item *&p_ref_ (ib ? break_malt_p_
- : nobreak_malt_p_);
+ Item *&p_ref_ (ib ? break_malt_p_
+ : nobreak_malt_p_);
if (!p_ref_)
{
p_ref_
- = new Single_malt_grouping_item
+ = new Item
(get_property ("basicSingleMaltGroupingItemProperties"));
if (ib)
p_ref_->set_elt_property ("breakable", SCM_BOOL_T);
announce_element (Score_element_info (p_ref_, 0));
}
- p_ref_->add_item (it);
+ Separation_item::add_item (p_ref_,it);
}
}
--- /dev/null
+/*
+ single-malt-grouping-item.cc -- implement Separation_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "separation-item.hh"
+#include "paper-column.hh"
+#include "debug.hh"
+#include "group-interface.hh"
+
+void
+Separation_item::set_interface (Score_element*s)
+{
+ s->set_elt_pointer ("elements", SCM_EOL);
+ s->set_extent_callback (0, X_AXIS);
+ s->set_extent_callback (0, Y_AXIS);
+}
+
+void
+Separation_item::add_item (Score_element*s,Item* i)
+{
+ assert (i);
+ Pointer_group_interface (s).add_element (i);
+ s->add_dependency (i);
+}
+
+Interval
+Separation_item::my_width (Score_element *me)
+{
+ Item *item = dynamic_cast<Item*> (me);
+ Paper_column * pc = item->column_l ();
+ Interval w;
+
+ for (SCM s = me->get_elt_pointer ("elements"); gh_pair_p (s); s = gh_cdr (s))
+ {
+ SCM elt = gh_car (s);
+ if (!SMOB_IS_TYPE_B(Score_element, elt))
+ continue;
+
+ Item *il = dynamic_cast<Item*> (unsmob_element (elt));
+ if (pc != il->column_l ())
+ {
+ /* this shouldn't happen, but let's continue anyway. */
+ programming_error (_("Separation_item: I've been drinking too much"));
+ continue; /*UGH UGH*/
+ }
+
+ if (to_boolean (il->get_elt_property ("no-spacing-rods")))
+ {
+ continue;
+ }
+
+ Interval iv (il->extent (X_AXIS));
+ if (!iv.empty_b ())
+ {
+ Real off = il->relative_coordinate (pc, X_AXIS);
+ w.unite (iv + off);
+ }
+ }
+
+ return w;
+ // add this->offset_ ? this-> relative_coordinate ()?
+}
+
+
+
*/
Real
-Side_position_interface::side_position (Score_element const *cme, Axis axis)
+Side_position_interface::side_position (Score_element *cme, Axis axis)
{
Score_element* me = (Score_element*)cme;
Score_element *common = me->parent_l (axis);
callback that centers the element on itself
*/
Real
-Side_position_interface::aligned_on_self (Score_element const*elm, Axis ax)
+Side_position_interface::aligned_on_self (Score_element *elm, Axis ax)
{
String s ("self-alignment-");
Callback that quantises in staff-spaces, rounding in the direction
of the elements "direction" elt property. */
Real
-Side_position_interface::quantised_position (Score_element const *me, Axis a)
+Side_position_interface::quantised_position (Score_element *me, Axis a)
{
Side_position_interface s(me);
Direction d = s.get_direction ();
- Staff_symbol_referencer_interface si (me);
- if (si.has_interface_b ())
+ if (Staff_symbol_referencer_interface::has_interface_b (me))
{
+ Staff_symbol_referencer_interface si (me);
Real p = si.position_f ();
Real rp = directed_round (p, d);
Position next to support, taking into account my own dimensions and padding.
*/
Real
-Side_position_interface::aligned_side (Score_element const*me, Axis ax)
+Side_position_interface::aligned_side (Score_element *me, Axis ax)
{
Side_position_interface s(me);
Direction d = s.get_direction ();
Position centered on parent.
*/
Real
-Side_position_interface::centered_on_parent (Score_element const* me, Axis a)
+Side_position_interface::centered_on_parent (Score_element * me, Axis a)
{
Score_element *him = me->parent_l (a);
Interval
-Span_bar::width_callback (Score_element const *se, Axis )
+Span_bar::width_callback (Score_element *se, Axis )
{
Span_bar* s= dynamic_cast<Span_bar*> ((Score_element*)se);
String gl = ly_scm2string (s->get_elt_property ("glyph"));
Interval
Span_bar::get_spanned_interval () const
{
- return Axis_group_interface::group_extent_callback (this, Y_AXIS);
+ return Axis_group_interface::group_extent_callback ((Span_bar*)this, Y_AXIS);
}
}
void
-Staff_symbol_referencer_interface::set_interface ()
+Staff_symbol_referencer_interface::set_interface (Score_element * e)
{
- if (!gh_number_p (elt_l_->get_elt_property ("staff-position")))
- elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0));
+ if (!gh_number_p (e->get_elt_property ("staff-position")))
+ e->set_elt_property ("staff-position", gh_double2scm (0.0));
- elt_l_->add_offset_callback (callback, Y_AXIS);
+ e->add_offset_callback (callback, Y_AXIS);
}
bool
-Staff_symbol_referencer_interface::has_interface_b ()
+Staff_symbol_referencer_interface::has_interface_b (Score_element*e)
{
- return unsmob_element (elt_l_->get_elt_pointer ("staff-symbol"))
- || gh_number_p (elt_l_->get_elt_property ("staff-position"));
+ return unsmob_element (e->get_elt_pointer ("staff-symbol"))
+ || gh_number_p (e->get_elt_property ("staff-position"));
}
should use offset callback!
*/
Real
-Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis )
+Staff_symbol_referencer_interface::callback (Score_element * sc,Axis )
{
Score_element* me = (Score_element*)sc; // UGH.
}
Interval
-Stem::dim_callback (Score_element const *se, Axis )
+Stem::dim_callback (Score_element *se, Axis )
{
Stem * s = dynamic_cast<Stem*> ((Score_element*)se);
}
Real
-Stem::off_callback (Score_element const* se, Axis)
+Stem::off_callback (Score_element * se, Axis)
{
Stem *st = dynamic_cast<Stem*> ((Score_element*)se);
/*
- text-item.cc -- implement Item
+ text-item.cc -- implement Text_item
source file of the GNU LilyPond music typesetter
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include "time-signature-engraver.hh"
#include "time-signature.hh"
#include "command-request.hh"
+#include "engraver.hh"
+
#include "timing-engraver.hh"
#include "engraver-group-engraver.hh"
+
+/**
+ generate time_signatures.
+ */
+class Time_signature_engraver : public Engraver {
+protected:
+ virtual void do_process_music();
+ virtual void do_pre_move_processing();
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Item * time_signature_p_;
+
+ Time_signature_engraver();
+};
+
+
Time_signature_engraver::Time_signature_engraver()
{
time_signature_p_ =0;
void
Time_signature_engraver::do_process_music()
{
+ /*
+ UGH.
+ this should use properties.
+ */
Translator * result =
daddy_grav_l()->get_simple_translator ("Timing_engraver"); // ugh
Time_signature_change_req *req = timing_grav_l->time_signature_req_l();
if (req)
{
- time_signature_p_ = new Time_signature (get_property ("basicTimeSignatureProperties"));
-
+ time_signature_p_ = new Item (get_property ("basicTimeSignatureProperties"));
time_signature_p_->set_elt_property ("fraction",
gh_cons (gh_int2scm (req->beats_i_),
gh_int2scm (req->one_beat_i_)));
#include "paper-def.hh"
#include "lookup.hh"
-Time_signature::Time_signature (SCM s)
- : Item (s)
-{
-
-}
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Time_signature,brew_molecule);
-// ugh.!
-
-GLUE_SCORE_ELEMENT(Time_signature,brew_molecule);
SCM
-Time_signature::member_brew_molecule () const
+Time_signature::brew_molecule (SCM smob)
{
- SCM st = get_elt_property ("style");
-
- SCM frac = get_elt_property ("fraction");
+ Score_element * me = unsmob_element (smob);
+ SCM st = me->get_elt_property ("style");
+ SCM frac = me->get_elt_property ("fraction");
int n = 4;
int d = 4;
if (gh_pair_p (frac))
String style (ly_scm2string (st));
if (style[0]=='1')
{
- return time_signature (n, 0).create_scheme();
+ return time_signature (me, n, 0).create_scheme();
}
else
{
- return special_time_signature (style, n, d).create_scheme();
+ return special_time_signature (me, style, n, d).create_scheme();
}
}
else
- return time_signature (n,d).create_scheme();
+ return time_signature (me, n,d).create_scheme();
}
Molecule
-Time_signature::special_time_signature (String s, int n, int d) const
+Time_signature::special_time_signature (Score_element*me, String s, int n, int d)
{
// First guess: s contains only the signature style
String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
- Molecule m = lookup_l ()->afm_find (symbolname, false);
+ Molecule m = me->lookup_l ()->afm_find (symbolname, false);
if (!m.empty_b())
return m;
// Second guess: s contains the full signature name
- m = lookup_l ()->afm_find ("timesig-"+s, false);
+ m = me->lookup_l ()->afm_find ("timesig-"+s, false);
if (!m.empty_b ())
return m;
// Resort to default layout with numbers
- return time_signature (n,d);
+ return time_signature (me, n,d);
}
Molecule
-Time_signature::time_signature (int num, int den) const
+Time_signature::time_signature (Score_element*me,int num, int den)
{
String sty = "timesig";
/*
UGH: need to look at fontsize.
*/
- Molecule n (lookup_l ()->text (sty, to_str (num), paper_l ()));
- Molecule d (lookup_l ()->text (sty, to_str (den), paper_l ()));
+ Molecule n (me->lookup_l ()->text (sty, to_str (num), me->paper_l ()));
+ Molecule d (me->lookup_l ()->text (sty, to_str (den), me->paper_l ()));
n.align_to (X_AXIS, CENTER);
d.align_to (X_AXIS, CENTER);
Molecule m;