From e5a4c2facd2ad6028bc3a21edffc6bc519f2b93c Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:24:26 +0000 Subject: [PATCH] lilypond-1.3.70 --- buildscripts/ps-to-pfa.py | 20 ++- lily/align-note-column-engraver.cc | 6 +- lily/axis-group-interface.cc | 2 +- lily/beam-engraver.cc | 15 +- lily/chord-tremolo-engraver.cc | 11 +- lily/collision-engraver.cc | 8 +- lily/collision.cc | 18 +- lily/dynamic-engraver.cc | 6 +- lily/include/beam.hh | 57 +++---- lily/include/collision.hh | 2 +- lily/include/multi-measure-rest.hh | 12 +- lily/include/note-column.hh | 29 ++-- lily/include/rest-collision.hh | 2 +- lily/include/rod.hh | 7 - lily/include/score-element.hh | 2 - lily/include/script.hh | 11 +- lily/include/separating-group-spanner.hh | 8 +- lily/include/slur.hh | 38 ++--- lily/include/stem.hh | 22 +-- lily/include/system-start-delimiter.hh | 17 +- lily/include/tie-column.hh | 8 +- lily/include/tie.hh | 2 +- lily/instrument-name-engraver.cc | 6 +- lily/multi-measure-rest-engraver.cc | 3 +- lily/multi-measure-rest.cc | 32 ++-- lily/note-column.cc | 57 +++---- lily/rest-collision-engraver.cc | 6 +- lily/rest-collision.cc | 22 +-- lily/rhythmic-column-engraver.cc | 23 +-- lily/rhythmic-head.cc | 1 + lily/score-element.cc | 4 - lily/script-engraver.cc | 11 +- lily/script.cc | 21 +-- lily/separating-group-spanner.cc | 41 +++-- lily/slur-engraver.cc | 20 ++- lily/slur.cc | 202 ++++++++++++----------- lily/spacing-engraver.cc | 45 ++++- lily/spanner.cc | 32 ---- lily/stem-engraver.cc | 7 +- lily/stem-tremolo.cc | 11 +- lily/stem.cc | 32 ++-- lily/system-start-delimiter-engraver.cc | 10 +- lily/system-start-delimiter.cc | 65 ++++---- lily/tie-column.cc | 14 +- lily/tie-engraver.cc | 4 +- lily/tie.cc | 25 +-- lily/tuplet-engraver.cc | 9 +- lily/tuplet-spanner.cc | 27 ++- ly/engraver.ly | 26 ++- 49 files changed, 528 insertions(+), 531 deletions(-) diff --git a/buildscripts/ps-to-pfa.py b/buildscripts/ps-to-pfa.py index 796c5d8b37..ef3c94a291 100644 --- a/buildscripts/ps-to-pfa.py +++ b/buildscripts/ps-to-pfa.py @@ -21,6 +21,8 @@ from string import * import re import time +logfile = sys.stdout + def program_id (): return name + ' version ' + version; @@ -58,19 +60,19 @@ for opt in options: def gulp_file (f): - sys.stderr.write ('[%s' % f) + logfile.write ('[%s' % f) try: i = open (f) i.seek (0, 2) n = i.tell () i.seek (0,0) except: - sys.stderr.write ('can\'t open file %s\n ' % f) + logfile.write ('can\'t open file %s\n ' % f) return '' s = i.read (n) - sys.stderr.write (']') + logfile.write (']') if len (s) <= 0: - sys.stderr.write ('gulped empty file: %s\n'% f) + logfile.write ('gulped empty file: %s\n'% f) return s mf = files[0] @@ -81,7 +83,7 @@ if not output_name: output_name = font_name + '.pfa' -sys.stderr.write ('Font: %s\n'% font_name) +logfile.write ('Font: %s\n'% font_name) def header (f): f.write ('%!PS-AdobeFont-3.0: ' + font_name + '\n') @@ -125,7 +127,7 @@ end % of font dictionary suspect_re = re.compile ('closepath ((gsave )*fill( grestore stroke)*) 1 setgray newpath (.*?) closepath fill') def characters (f): - sys.stderr.write ('[') + logfile.write ('[') files = [] import find # q @@ -179,14 +181,14 @@ def characters (f): f.write ('end % of CharProcs\n') f.write (encoding) f.write ('\n') - sys.stderr.write (']') + logfile.write (']') ps_file = open (output_name, 'w') header (ps_file) characters (ps_file) footer (ps_file) -sys.stderr.write ('\n') +logfile.write ('\n') ps_file.close () -sys.stderr.write ('Wrote PostScript font: %s\n' % output_name) +logfile.write ('Wrote PostScript font: %s\n' % output_name) diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index cbe7a931f0..05a51c710b 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -22,7 +22,7 @@ class Align_note_column_engraver: public Engraver { Item * align_item_p_; - Note_column * now_column_l_; + Score_element * now_column_l_; Score_element * accidental_l_; virtual void process_acknowledged (); @@ -71,9 +71,9 @@ Align_note_column_engraver::do_removal_processing () void Align_note_column_engraver::acknowledge_element (Score_element_info inf) { - if (Note_column * n = dynamic_cast (inf.elem_l_)) + if (Note_column::has_interface(inf.elem_l_)) { - now_column_l_ =n; + now_column_l_ =inf.elem_l_; } else if (Local_key_item::has_interface (inf.elem_l_)) { diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 12eac16329..3b144f624f 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -125,6 +125,6 @@ Axis_group_interface::set_interface (Score_element*me) if (!has_interface (me)) { me->set_interface (ly_symbol2scm ("axis-group-interface")); - me->set_elt_property ("elements", SCM_EOL); } + me->set_elt_property ("elements", SCM_EOL); } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index dedbad0dd0..1678dff784 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -16,13 +16,15 @@ #include "score-engraver.hh" #include "rest.hh" #include "drul-array.hh" +#include "item.hh" +#include "spanner.hh" class Beam_engraver : public Engraver { Drul_array reqs_drul_; - Beam *finished_beam_p_; - Beam *beam_p_; + Spanner *finished_beam_p_; + Spanner *beam_p_; Span_req * prev_start_req_; Beaming_info_list * beam_info_p_; @@ -120,8 +122,9 @@ Beam_engraver::do_process_music () } prev_start_req_ = reqs_drul_[START]; - beam_p_ = new Beam (get_property ("basicBeamProperties")); - + beam_p_ = new Spanner (get_property ("basicBeamProperties")); + Beam::set_interface (beam_p_); + SCM smp = get_property ("measurePosition"); Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); @@ -143,7 +146,7 @@ Beam_engraver::typeset_beam () { finished_beam_info_p_->beamify (); - finished_beam_p_->set_beaming (finished_beam_info_p_); + Beam::set_beaming (finished_beam_p_, finished_beam_info_p_); typeset_element (finished_beam_p_); delete finished_beam_info_p_; finished_beam_info_p_ =0; @@ -229,7 +232,7 @@ Beam_engraver::acknowledge_element (Score_element_info info) Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_; beam_info_p_->add_stem (stem_location, (rhythmic_req->duration_.durlog_i_ - 2) >? 1); - beam_p_->add_stem (stem_l); + Beam::add_stem (beam_p_, stem_l); } } } diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index d670feb130..87fdecbce8 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -17,6 +17,8 @@ #include "warn.hh" #include "misc.hh" #include "note-head.hh" +#include "spanner.hh" +#include "item.hh" /** This acknowledges repeated music with "tremolo" style. It typesets @@ -49,8 +51,8 @@ protected: int note_head_i_; - Beam * beam_p_; - Beam * finished_beam_p_; + Spanner * beam_p_; + Spanner * finished_beam_p_; protected: virtual void do_removal_processing(); @@ -91,7 +93,8 @@ Chord_tremolo_engraver::do_process_music () { if (repeat_ && !beam_p_) { - beam_p_ = new Beam (get_property ("basicBeamProperties")); + beam_p_ = new Spanner (get_property ("basicBeamProperties")); + Beam::set_interface (beam_p_); beam_p_->set_elt_property ("chord-tremolo", SCM_BOOL_T); @@ -160,7 +163,7 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info info) if (Rhythmic_req* r = dynamic_cast (info.req_l_)) { - beam_p_->add_stem (s); + Beam::add_stem (beam_p_, s); Moment stem_location = now_mom () - start_mom_ + beam_start_location_; } diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc index 8816100638..9b3218de78 100644 --- a/lily/collision-engraver.cc +++ b/lily/collision-engraver.cc @@ -17,7 +17,7 @@ a collision object. */ class Collision_engraver : public Engraver { Item * col_p_; - Link_array note_column_l_arr_; + Link_array note_column_l_arr_; protected: virtual void acknowledge_element (Score_element_info); @@ -50,13 +50,13 @@ Collision_engraver::process_acknowledged () void Collision_engraver::acknowledge_element (Score_element_info i) { - if (Note_column * c = dynamic_cast (i.elem_l_)) + if (Note_column::has_interface (i.elem_l_)) { /*should check Y axis? */ - if (c->rest_b () || c->parent_l(X_AXIS)) + if (Note_column::rest_b (i.elem_l_) || i.elem_l_->parent_l(X_AXIS)) return ; - note_column_l_arr_.push (c); + note_column_l_arr_.push (i.elem_l_); } } diff --git a/lily/collision.cc b/lily/collision.cc index a52c130048..8d1f6d1232 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -14,7 +14,7 @@ #include "item.hh" void -Collision::add_column (Score_element*me,Note_column* ncol_l) +Collision::add_column (Score_element*me,Score_element* ncol_l) { ncol_l->add_offset_callback (force_shift_callback, X_AXIS); Axis_group_interface::add_element (me, ncol_l); @@ -77,7 +77,7 @@ Collision::do_shifts(Score_element* me) SCM Collision::automatic_shift (Score_element *me) { - Drul_array > clash_groups; + Drul_array > clash_groups; Drul_array > shifts; SCM tups = SCM_EOL; @@ -87,8 +87,8 @@ Collision::automatic_shift (Score_element *me) SCM car = gh_car (s); Score_element * se = unsmob_element (car); - if (Note_column * col = dynamic_cast (se)) - clash_groups[col->dir ()].push (col); + if (Note_column::has_interface (se)) + clash_groups[Note_column::dir (se)].push (se); } @@ -96,7 +96,7 @@ Collision::automatic_shift (Score_element *me) do { Array & shift (shifts[d]); - Link_array & clashes (clash_groups[d]); + Link_array & clashes (clash_groups[d]); clashes.sort (Note_column::shift_compare); @@ -157,15 +157,15 @@ Collision::automatic_shift (Score_element *me) all of them again. */ if (extents[UP].size () && extents[DOWN].size ()) { - Note_column *cu_l =clash_groups[UP][0]; - Note_column *cd_l =clash_groups[DOWN][0]; + Score_element *cu_l =clash_groups[UP][0]; + Score_element *cd_l =clash_groups[DOWN][0]; /* TODO. */ - Score_element * nu_l= cu_l->first_head(); - Score_element * nd_l = cd_l->first_head(); + Score_element * nu_l= Note_column::first_head(cu_l); + Score_element * nd_l = Note_column::first_head(cd_l); int downpos = Note_column::head_positions_interval (cd_l)[BIGGER]; int uppos = Note_column::head_positions_interval (cu_l)[SMALLER]; diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 967dcc1886..f0390d4798 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -333,12 +333,12 @@ Dynamic_engraver::typeset_all () void Dynamic_engraver::acknowledge_element (Score_element_info i) { - if (Note_column* n = dynamic_cast (i.elem_l_)) + if (Note_column::has_interface (i.elem_l_)) { if (line_spanner_) { - Side_position::add_support (line_spanner_,n); - add_bound_item (line_spanner_,n); + Side_position::add_support (line_spanner_,i.elem_l_); + add_bound_item (line_spanner_,dynamic_cast(i.elem_l_)); } } } diff --git a/lily/include/beam.hh b/lily/include/beam.hh index dba75f2045..b83254e1c5 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -8,7 +8,7 @@ #define BEAM_HH #include "lily-proto.hh" -#include "spanner.hh" +#include "lily-guile.hh" /** a beam connects multiple stems. @@ -25,44 +25,41 @@ damping -- amount of beam slope damping. (int) should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams */ -class Beam : public Spanner +class Beam { public: - - - int visible_stem_count () const; - Item* first_visible_stem () const; - Item* last_visible_stem () const; + static int visible_stem_count (Score_element*); + static Item* first_visible_stem (Score_element*); + static Item* last_visible_stem (Score_element*); + static bool has_interface (Score_element*); + static void set_interface (Score_element*); static Real rest_collision_callback (Score_element *,Axis); Beam (SCM); - void add_stem (Score_element*); - void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current); - void set_beaming (Beaming_info_list *); - void set_stemlens (); - VIRTUAL_COPY_CONS(Score_element); - - int get_multiplicity () const; - + static void add_stem (Score_element*,Score_element*); + static void set_grouping (Score_element*,Rhythmic_grouping def, Rhythmic_grouping current); + static void set_beaming (Score_element*,Beaming_info_list *); + static void set_stemlens (Score_element*); + static int get_multiplicity (Score_element*me); static SCM brew_molecule (SCM); static SCM before_line_breaking (SCM); static SCM after_line_breaking (SCM); + static Molecule stem_beams (Score_element*,Item *here, Item *next, Item *prev); - Molecule stem_beams (Item *here, Item *next, Item *prev) const; private: - Direction get_default_dir () const; - void set_stem_directions (); - void auto_knees (); - bool auto_knee (String gap_str, bool interstaff_b); - void set_stem_shorten (); - void calc_default_position_and_height (Real* y, Real* dy) const; - bool suspect_slope_b (Real y, Real dy) const; - Real calc_slope_damping_f (Real dy) const; - Real calc_stem_y_f (Item* s, Real y, Real dy) const; - Real check_stem_length_f (Real y, Real dy) const; - void set_stem_length (Real y, Real dy); - Real quantise_dy_f (Real dy) const; - Real quantise_y_f (Real y, Real dy, int quant_dir); - int forced_stem_count () const; + static Direction get_default_dir (Score_element*); + static void set_stem_directions (Score_element*); + static void auto_knees (Score_element*); + static bool auto_knee (Score_element*,String gap_str, bool interstaff_b); + static void set_stem_shorten (Score_element*); + static void calc_default_position_and_height (Score_element*,Real* y, Real* dy); + static bool suspect_slope_b (Score_element*, Real y, Real dy); + static Real calc_slope_damping_f (Score_element*, Real dy); + static Real calc_stem_y_f (Score_element*, Item* s, Real y, Real dy); + static Real check_stem_length_f (Score_element*, Real y, Real dy); + static void set_stem_length (Score_element*, Real y, Real dy); + static Real quantise_dy_f (Score_element*, Real dy); + static Real quantise_y_f (Score_element*, Real y, Real dy, int quant_dir); + static int forced_stem_count (Score_element*); }; #endif // BEAM_HH diff --git a/lily/include/collision.hh b/lily/include/collision.hh index 469dfeacbd..10c5397a6e 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -43,6 +43,6 @@ public: static SCM forced_shift (Score_element*); static Real force_shift_callback (Score_element *, Axis); static void do_shifts (Score_element*); - static void add_column (Score_element*me,Note_column*ncol_l); + static void add_column (Score_element*me,Score_element*ncol_l); }; #endif // COLLISION_HH diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 71353da3b1..4b57a9662c 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -10,20 +10,18 @@ #ifndef MULTI_MEASURE_REST_HH #define MULTI_MEASURE_REST_HH -#include "spanner.hh" +#include "lily-proto.hh" +#include "lily-guile.hh" +#include "rod.hh" - -class Multi_measure_rest : public Spanner +class Multi_measure_rest { public: - Multi_measure_rest (SCM); - static void set_interface (Score_element*); static bool has_interface (Score_element*); static SCM brew_molecule (SCM); static void add_column (Score_element*,Item*); - VIRTUAL_COPY_CONS (Score_element); - virtual Array get_rods () const; + static SCM set_spacing_rods (SCM); }; #endif /* MULTI_MEASURE_REST_HH */ diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 7bf51956d5..855d655cd6 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -18,33 +18,30 @@ UGR. Junkme. refpoint should be the notehead, dir should come from stem. */ -class Note_column : public Item +class Note_column { public: - static int shift_compare (Note_column *const &, Note_column*const&); + static int shift_compare (Score_element *const &, Score_element*const&); /** The relative position of the "voice" containing this chord. Normally this would be the same as the stem direction, JUNKME. */ - Direction dir () const; - - static Slice head_positions_interval(Score_element* me) ; + static Direction dir (Score_element*me); + static Slice head_positions_interval(Score_element* me); static Direction static_dir (Score_element*); - void translate_rests(int dy); - Score_element * first_head ()const; - Interval rest_dim ()const ; - Note_column (SCM); - void set_stem (Score_element*); - void set_dotcol (Score_element*); - void add_head (Score_element*); - bool rest_b () const; - + static void translate_rests(Score_element*me,int dy); + static Score_element * first_head (Score_element*me); + static Interval rest_dim (Score_element*me); + static void set_stem (Score_element*me,Score_element*); + static void set_dotcol (Score_element*me,Score_element*); + static void add_head (Score_element*me,Score_element*); + static bool rest_b (Score_element*me); static bool has_interface (Score_element*); - - Item *stem_l()const; + static void set_interface (Score_element*); + static Item *stem_l(Score_element*); }; #endif // NOTE_COLUMN_HH diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index 39a9fcd120..79b7b8aa72 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -16,7 +16,7 @@ class Rest_collision // interface { public: - static void add_column (Score_element*me,Note_column*); + static void add_column (Score_element*me,Score_element*); static void set_interface (Score_element*me); static bool has_interface (Score_element*); static Real force_shift_callback (Score_element *, Axis); diff --git a/lily/include/rod.hh b/lily/include/rod.hh index f76a4e5b0c..d795f539ad 100644 --- a/lily/include/rod.hh +++ b/lily/include/rod.hh @@ -13,13 +13,6 @@ #include "direction.hh" #include "drul-array.hh" -struct Column_rod -{ - Paper_column *other_l_; - Real distance_f_; - - Column_rod (); -}; struct Rod diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 0fd7fd077f..ebd656070d 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -139,8 +139,6 @@ public: virtual void do_break_processing (); virtual Score_element *find_broken_piece (Line_of_score*) const; - /// generate rods & springs - virtual void do_space_processing (); virtual void discretionary_processing (); virtual void do_derived_mark (); diff --git a/lily/include/script.hh b/lily/include/script.hh index b983b54716..0e4dfae387 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -10,19 +10,20 @@ #ifndef SCRIPT_HH #define SCRIPT_HH -#include "item.hh" -#include "drul-array.hh" +#include "lily-guile.hh" +#include "lily-proto.hh" /** Articulation marks (and the like) that are attached to notes/stems. Needs support from Staff_side for proper operation. Staff_side handles the positioning. */ -class Script : public Item +class Script { public: - static Molecule get_molecule (Score_element*,Direction d); - Script (SCM); + static Molecule get_molecule (Score_element*,Direction d); + static void set_interface (Score_element*); + static bool has_interface (Score_element*); static SCM brew_molecule (SCM); static SCM after_line_breaking (SCM); }; diff --git a/lily/include/separating-group-spanner.hh b/lily/include/separating-group-spanner.hh index 5c46dc3f8d..d01b6dbb51 100644 --- a/lily/include/separating-group-spanner.hh +++ b/lily/include/separating-group-spanner.hh @@ -12,14 +12,12 @@ #include "spanner.hh" -class Separating_group_spanner : public Spanner +class Separating_group_spanner { public: static void add_spacing_unit (Score_element*me, Item*); - Separating_group_spanner(SCM); -protected: - VIRTUAL_COPY_CONS(Score_element); - virtual Array get_rods () const; + static void set_interface (Score_element*); + static SCM set_spacing_rods (SCM); }; #endif /* SEPARATING_GROUP_SPANNER_HH */ diff --git a/lily/include/slur.hh b/lily/include/slur.hh index c9f6052d5a..83d0900834 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -7,34 +7,28 @@ #ifndef SLUR_HH #define SLUR_HH -#include "spanner.hh" +#include "lily-guile.hh" +#include "lily-proto.hh" #include "rod.hh" -/** - A #Bow# which tries to drape itself around the stems too. - */ -class Slur : public Spanner +class Slur { public: - Slur (SCM); - VIRTUAL_COPY_CONS(Score_element); - - void add_column (Note_column*); - static SCM brew_molecule (SCM); - - Array get_encompass_offset_arr () const; - Bezier get_curve () const; - - Direction get_default_dir () const; + static void add_column (Score_element*me,Score_element*col); + static SCM brew_molecule (SCM); + static void set_interface (Score_element*); + static bool has_interface (Score_element*); + static Array get_encompass_offset_arr (Score_element*me) ; + static Bezier get_curve (Score_element*me) ; + static Direction get_default_dir (Score_element*me) ; static SCM after_line_breaking (SCM); - Array get_rods () const; - Offset get_attachment (Direction dir, Score_element**common) const; - + static SCM set_spacing_rods (SCM); private: - void de_uglyfy (Slur_bezier_bow* bb, Real default_height); - void set_extremities (); - void set_control_points (); - Offset encompass_offset (Score_element *col,Score_element**common)const; + static Offset get_attachment (Score_element*me,Direction dir, Score_element**common) ; + static void de_uglyfy (Score_element*me,Slur_bezier_bow* bb, Real default_height); + static void set_extremities (Score_element*me); + static void set_control_points (Score_element*me); + static Offset encompass_offset (Score_element*me,Score_element *col,Score_element**common); }; #endif // SLUR_HH diff --git a/lily/include/stem.hh b/lily/include/stem.hh index d3b9eb8a1e..8c3e6f7691 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -7,10 +7,8 @@ #ifndef STEM_HH #define STEM_HH -#include "item.hh" -#include "array.hh" -#include "moment.hh" -#include "molecule.hh" +#include "lily-proto.hh" +#include "lily-guile.hh" #include "stem-info.hh" /**the rule attached to the ball. @@ -36,36 +34,29 @@ /// how many abbrev beam don't reach stem? int beam_gap_i_; - - */ -class Stem : public Item +class Stem { public: static SCM brew_molecule (SCM); /// log of the duration. Eg. 4 -> 16th note -> 2 flags static int flag_i (Score_element*) ; - static int beam_count (Score_element*,Direction) ; static void set_beaming (Score_element*,int, Direction d); /** don't print flag when in beam. our beam, for aligning abbrev flags */ - static Beam * beam_l (Score_element*); + static Score_element * beam_l (Score_element*); static Score_element * first_head (Score_element*) ; static Drul_array extremal_heads (Score_element*); - static Score_element * support_head (Score_element*) ; - Stem (SCM); - + /// ensure that this Stem also encompasses the Notehead #n# static void add_head (Score_element*me, Score_element*n); - static Stem_info calc_stem_info (Score_element *) ; - static Real chord_start_f (Score_element *) ; static Direction get_direction (Score_element*) ; static int type_i (Score_element *) ; @@ -73,13 +64,10 @@ public: static Direction get_default_dir(Score_element *) ; static int get_center_distance(Score_element *,Direction) ; static int heads_i (Score_element *) ; - static bool invisible_b(Score_element *) ; /// heads that the stem encompasses (positions) static Interval head_positions(Score_element *) ; - - static Real get_default_stem_end_position (Score_element*me) ; static void position_noteheads(Score_element*); static Real stem_end_position (Score_element*) ; diff --git a/lily/include/system-start-delimiter.hh b/lily/include/system-start-delimiter.hh index b5c500c6f7..121713d9e6 100644 --- a/lily/include/system-start-delimiter.hh +++ b/lily/include/system-start-delimiter.hh @@ -10,25 +10,24 @@ #ifndef SYSTEM_START_DELIMITER_HH #define SYSTEM_START_DELIMITER_HH -#include "spanner.hh" +#include "lily-guile.hh" +#include "lily-proto.hh" /* Braces/brackets across staffs. */ -class System_start_delimiter : public Spanner +class System_start_delimiter { public: - System_start_delimiter (SCM); static SCM brew_molecule (SCM); - VIRTUAL_COPY_CONS (Score_element); - + static void set_interface (Score_element*me); + static bool has_interface (Score_element*); static SCM after_line_breaking (SCM); static void try_collapse (Score_element*); - - Molecule staff_bracket (Real) const; - Molecule staff_brace (Real) const; - Molecule simple_bar (Real) const; + static Molecule staff_bracket (Score_element*,Real) ; + static Molecule staff_brace (Score_element*,Real) ; + static Molecule simple_bar (Score_element*,Real) ; }; #endif /* SYSTEM_START_DELIMITER_HH */ diff --git a/lily/include/tie-column.hh b/lily/include/tie-column.hh index bbee8fede5..8dfab669bd 100644 --- a/lily/include/tie-column.hh +++ b/lily/include/tie-column.hh @@ -11,17 +11,15 @@ #ifndef TIE_COLUMN_HH #define TIE_COLUMN_HH -#include "spanner.hh" +#include "lily-proto.hh" +#include "lily-guile.hh" -class Tie_column : public Spanner +class Tie_column { public: - Tie_column (SCM s); - VIRTUAL_COPY_CONS (Score_element); static void set_interface (Score_element*me); static bool has_interface (Score_element*); static void add_tie (Score_element*me,Tie*); - static SCM after_line_breaking (SCM); static void set_directions (Score_element*me); }; diff --git a/lily/include/tie.hh b/lily/include/tie.hh index ea1f5f97f3..422a9fa375 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -38,7 +38,7 @@ public: Bezier get_curve () const; Drul_array dy_f_drul_; Drul_array dx_f_drul_; - virtual Array get_rods () const; + static SCM set_spacing_rods (SCM); Array get_controls () const; }; diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 910a8f8ef5..8b65565b94 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -17,7 +17,7 @@ class Instrument_name_engraver : public Engraver { Item *text_; - System_start_delimiter * delim_ ; + Spanner * delim_ ; void create_text (SCM s); public: @@ -84,10 +84,10 @@ Instrument_name_engraver::acknowledge_element (Score_element_info i) } } - if (dynamic_cast (i.elem_l_) + if (System_start_delimiter::has_interface (i.elem_l_) && i.origin_trans_l_->daddy_trans_l_ == daddy_trans_l_) { - delim_ = dynamic_cast (i.elem_l_); + delim_ = dynamic_cast (i.elem_l_); } } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 84d5061e7f..6a5d06ed7d 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -111,7 +111,8 @@ Multi_measure_rest_engraver::do_process_music () if (busy_span_req_l_ && !mmrest_p_) { - mmrest_p_ = new Multi_measure_rest (get_property ("basicMultiMeasureRestProperties")); + mmrest_p_ = new Spanner (get_property ("basicMultiMeasureRestProperties")); + Multi_measure_rest::set_interface (mmrest_p_); Staff_symbol_referencer::set_interface (mmrest_p_); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 6d95336d3a..ba2e2cbc24 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -11,24 +11,20 @@ #include "debug.hh" #include "paper-def.hh" #include "paper-column.hh" // urg -#include "bar.hh" #include "lookup.hh" #include "rest.hh" #include "molecule.hh" #include "misc.hh" #include "group-interface.hh" -#include "stem.hh" +#include "spanner.hh" #include "staff-symbol-referencer.hh" + void Multi_measure_rest::set_interface (Score_element*me) { me->set_elt_property ("columns", SCM_EOL); } -Multi_measure_rest::Multi_measure_rest (SCM s) - : Spanner(s) -{} - /* [TODO] 17 * variable-sized multi-measure rest symbol: |====| ?? @@ -151,19 +147,22 @@ Multi_measure_rest::add_column (Score_element*me,Item* c) } -Array -Multi_measure_rest::get_rods () const +MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_spacing_rods); + +SCM +Multi_measure_rest::set_spacing_rods (SCM smob) { - Array a; + Score_element*me = unsmob_element (smob); - if (!(get_bound (LEFT) && get_bound (RIGHT))) + Spanner*sp = dynamic_cast (me); + if (!(sp->get_bound (LEFT) && sp->get_bound (RIGHT))) { programming_error ("Multi_measure_rest::get_rods (): I am not spanned!"); - return a; + return SCM_UNDEFINED; } - Item * l = get_bound (LEFT)->column_l (); - Item * r = get_bound (RIGHT)->column_l (); + Item * l = sp->get_bound (LEFT)->column_l (); + Item * r = sp->get_bound (RIGHT)->column_l (); Item * lb = l->find_prebroken_piece (RIGHT); Item * rb = r->find_prebroken_piece (LEFT); @@ -184,11 +183,10 @@ Multi_measure_rest::get_rods () const should do something more advanced. */ rod.distance_f_ = l->extent (X_AXIS)[BIGGER] - r->extent (X_AXIS)[SMALLER] - + paper_l ()->get_var ("multi_measure_rest_x_minimum"); + + me->paper_l ()->get_var ("multi_measure_rest_x_minimum"); - a.push (rod); + rod.add_to_cols (); } - - return a; + return SCM_UNDEFINED; } diff --git a/lily/note-column.cc b/lily/note-column.cc index 7616a119b5..473c014663 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -18,13 +18,13 @@ #include "note-head.hh" bool -Note_column::rest_b () const +Note_column::rest_b (Score_element*me) { - return unsmob_element (get_elt_property ("rest")); + return unsmob_element (me->get_elt_property ("rest")); } int -Note_column::shift_compare (Note_column *const &p1, Note_column*const&p2) +Note_column::shift_compare (Score_element *const &p1, Score_element *const&p2) { SCM s1 = p1->get_elt_property ("horizontal-shift"); SCM s2 = p2->get_elt_property ("horizontal-shift"); @@ -34,10 +34,9 @@ Note_column::shift_compare (Note_column *const &p1, Note_column*const&p2) return h1 - h2; } -Note_column::Note_column( SCM s) - : Item (s) +void +Note_column::set_interface (Score_element* me) { - Score_element* me = this; me->set_elt_property ("note-heads", SCM_EOL); me->set_interface (ly_symbol2scm ("note-column-interface")); @@ -46,12 +45,11 @@ Note_column::Note_column( SCM s) } Item * -Note_column::stem_l () const +Note_column::stem_l (Score_element*me) { - SCM s = get_elt_property ("stem"); + SCM s = me->get_elt_property ("stem"); return dynamic_cast(unsmob_element (s)); } - Slice Note_column::head_positions_interval(Score_element *me) @@ -72,7 +70,7 @@ Note_column::head_positions_interval(Score_element *me) } Direction -Note_column::static_dir (Score_element* me) +Note_column::dir (Score_element* me) { Score_element *stem = unsmob_element (me->get_elt_property ("stem")); if (stem && Stem::has_interface (stem)) @@ -85,43 +83,36 @@ Note_column::static_dir (Score_element* me) } -Direction -Note_column::dir () const -{ - return static_dir ((Score_element*) this); -} - void -Note_column::set_stem (Score_element * stem_l) +Note_column::set_stem (Score_element*me,Score_element * stem_l) { - set_elt_property ("stem", stem_l->self_scm_); - - add_dependency (stem_l); - Axis_group_interface::add_element (this, stem_l); + me->set_elt_property ("stem", stem_l->self_scm_); + me->add_dependency (stem_l); + Axis_group_interface::add_element (me, stem_l); } void -Note_column::add_head (Score_element *h) +Note_column::add_head (Score_element*me,Score_element *h) { if (Rest::has_interface (h)) { - this->set_elt_property ("rest", h->self_scm_); + me->set_elt_property ("rest", h->self_scm_); } else if (Note_head::has_interface (h)) { - Pointer_group_interface gi (this, "note-heads"); + Pointer_group_interface gi (me, "note-heads"); gi.add_element (h); } - Axis_group_interface::add_element (this, h); + Axis_group_interface::add_element (me, h); } /** translate the rest symbols vertically by amount DY_I. */ void -Note_column::translate_rests (int dy_i) +Note_column::translate_rests (Score_element*me,int dy_i) { - Score_element * r = unsmob_element (get_elt_property ("rest")); + Score_element * r = unsmob_element (me->get_elt_property ("rest")); if (r) { r->translate_axis (dy_i * Staff_symbol_referencer::staff_space (r)/2.0, Y_AXIS); @@ -130,24 +121,24 @@ Note_column::translate_rests (int dy_i) void -Note_column::set_dotcol (Score_element *d) +Note_column::set_dotcol (Score_element*me,Score_element *d) { - Axis_group_interface::add_element (this, d); + Axis_group_interface::add_element (me, d); } Interval -Note_column::rest_dim () const +Note_column::rest_dim (Score_element*me) { - Score_element * r = unsmob_element (get_elt_property ("rest")); + Score_element * r = unsmob_element (me->get_elt_property ("rest")); return r->extent (Y_AXIS); } Score_element* -Note_column::first_head () const +Note_column::first_head (Score_element*me) { - Score_element * st = stem_l (); + Score_element * st = stem_l (me); return st? Stem::first_head (st): 0; } diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index fc310aef05..e748b88c01 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -16,7 +16,7 @@ class Rest_collision_engraver : public Engraver { Item* rest_collision_p_; - Link_array note_column_l_arr_; + Link_array note_column_l_arr_; protected: virtual void acknowledge_element (Score_element_info); virtual void process_acknowledged (); @@ -50,8 +50,8 @@ Rest_collision_engraver::process_acknowledged () void Rest_collision_engraver::acknowledge_element (Score_element_info i) { - if (dynamic_cast (i.elem_l_)) - note_column_l_arr_.push (dynamic_cast (i.elem_l_)); + if (Note_column::has_interface (i.elem_l_)) + note_column_l_arr_.push (i.elem_l_); } void diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 7a26dee1a9..9d86cbb81b 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -41,7 +41,7 @@ Rest_collision::force_shift_callback (Score_element *them, Axis a) } void -Rest_collision::add_column (Score_element*me,Note_column *p) +Rest_collision::add_column (Score_element*me,Score_element *p) { me->add_dependency (p); Pointer_group_interface gi (me); @@ -72,16 +72,16 @@ Rest_collision::do_shift (Score_element *me, SCM elts) /* ugh. -> score elt type */ - Link_array rests; - Link_array notes; + Link_array rests; + Link_array notes; for (SCM s = elts; gh_pair_p (s); s = gh_cdr (s)) { Score_element * e = unsmob_element (gh_car (s)); if (e && unsmob_element (e->get_elt_property ("rest"))) - rests.push (dynamic_cast (e)); + rests.push (e); else - notes.push (dynamic_cast (e)); + notes.push (e); } @@ -147,8 +147,8 @@ Rest_collision::do_shift (Score_element *me, SCM elts) int dy = display_count > 2 ? 6 : 4; if (display_count > 1) { - rests[0]->translate_rests (dy); - rests[1]->translate_rests (-dy); + Note_column::translate_rests (rests[0],dy); + Note_column::translate_rests (rests[1], -dy); } } // meisjes met jongetjes @@ -162,12 +162,12 @@ Rest_collision::do_shift (Score_element *me, SCM elts) { warning (_("too many notes for rest collision")); } - Note_column * rcol = rests[0]; + Score_element * rcol = rests[0]; // try to be opposite of noteheads. - Direction dir = - notes[0]->dir(); + Direction dir = - Note_column::dir (notes[0]); - Interval restdim = rcol->rest_dim (); + Interval restdim = Note_column::rest_dim (rcol); if (restdim.empty_b ()) return SCM_UNDEFINED; @@ -208,7 +208,7 @@ Rest_collision::do_shift (Score_element *me, SCM elts) if (discrete_dist < stafflines+1) discrete_dist = int (ceil (discrete_dist / 2.0)* 2.0); - rcol->translate_rests (dir * discrete_dist); + Note_column::translate_rests (rcol,dir * discrete_dist); } return SCM_UNDEFINED; } diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index b83520535c..82c02d9a4a 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -19,9 +19,9 @@ class Rhythmic_column_engraver :public Engraver { Link_array rhead_l_arr_; - Link_array grace_slur_endings_; + Link_array grace_slur_endings_; Score_element * stem_l_; - Note_column *ncol_p_; + Score_element *ncol_p_; Score_element *dotcol_l_; protected: @@ -52,14 +52,15 @@ Rhythmic_column_engraver::process_acknowledged () { if (!ncol_p_) { - ncol_p_ = new Note_column (get_property("basicNoteColumnProperties")); + ncol_p_ = new Item (get_property("basicNoteColumnProperties")); + Note_column::set_interface (ncol_p_); announce_element (Score_element_info (ncol_p_, 0)); } for (int i=0; i < rhead_l_arr_.size (); i++) { if (!rhead_l_arr_[i]->parent_l(X_AXIS)) - ncol_p_->add_head (rhead_l_arr_[i]); + Note_column::add_head (ncol_p_, rhead_l_arr_[i]); } rhead_l_arr_.set_size (0); } @@ -70,13 +71,13 @@ Rhythmic_column_engraver::process_acknowledged () if (dotcol_l_ && !dotcol_l_->parent_l (X_AXIS)) { - ncol_p_->set_dotcol (dotcol_l_); + Note_column::set_dotcol (ncol_p_, dotcol_l_); } if (stem_l_ && !stem_l_->parent_l(X_AXIS)) { - ncol_p_->set_stem (stem_l_); + Note_column::set_stem (ncol_p_, stem_l_); stem_l_ = 0; } @@ -85,7 +86,7 @@ Rhythmic_column_engraver::process_acknowledged () if (!wegrace) for (int i=0; i < grace_slur_endings_.size(); i++) - grace_slur_endings_[i]->add_column (ncol_p_); + Slur::add_column (grace_slur_endings_[i], ncol_p_); grace_slur_endings_.clear (); } } @@ -96,7 +97,7 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i) SCM wg = get_property ("weAreGraceContext"); bool wegrace = to_boolean (wg); if (wegrace != to_boolean (i.elem_l_->get_elt_property ("grace")) - && !dynamic_cast (i.elem_l_)) + && !Slur::has_interface (i.elem_l_)) return ; Item * item = dynamic_cast (i.elem_l_); @@ -112,14 +113,14 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i) { dotcol_l_ = item; } - else if (Slur *s = dynamic_cast (i.elem_l_)) + else if (Slur::has_interface (i.elem_l_)) { /* end slurs starting on grace notes */ - if (to_boolean (s->get_elt_property ("grace"))) - grace_slur_endings_.push (s); + if (to_boolean (i.elem_l_->get_elt_property ("grace"))) + grace_slur_endings_.push (i.elem_l_); } } diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 9c8cb00b50..63006674fc 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -16,6 +16,7 @@ #include "paper-score.hh" #include "stem.hh" #include "staff-symbol-referencer.hh" +#include "item.hh" Item* diff --git a/lily/score-element.cc b/lily/score-element.cc index 5b17ffbbd3..47ca5c9eea 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -265,10 +265,6 @@ Score_element::do_break_processing() { } -void -Score_element::do_space_processing () -{ -} void Score_element::do_add_processing() diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 2f433d9d37..effd5b7123 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -10,12 +10,10 @@ #include "musical-request.hh" #include "stem.hh" #include "rhythmic-head.hh" - - #include "engraver.hh" class Script_engraver : public Engraver { - Link_array