From: fred Date: Tue, 26 Mar 2002 22:42:54 +0000 (+0000) Subject: lilypond-1.3.1 X-Git-Tag: release/1.5.59~2016 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=12b9ec9905f0fb57a4d4b2d0ed6528686b323f03;p=lilypond.git lilypond-1.3.1 --- diff --git a/CHANGES b/CHANGES index 661f51cdb5..b7f048a100 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,19 @@ +pl 3.hwn2,1 + - Generic properties and Property_engraver. Moved most of the +properties. + +0.lu1 + - resurrected midi2ly + +0.jcn1 + - bf: lyrics lexer + - reverted mup2ly revert + +pl 3.uu1: + - frontport of 1.2.17 patches. + +********** + 1.3.0: pl 15.hwn2 diff --git a/TODO b/TODO index 68c356c704..771ea60f80 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,13 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. .* TODO . * make this file understandable for 3rd parties. . * use Rhythmic_head::position_i () for all Staff_referenced +. * eradicate all VIRTUAL_COPY_CONS () macros ; use indexed creation, + eg. + + ctor_dict["Score_element"]->clone_func (orig); + ctor_dict["Score_element"]->create_func (); + + . * note head on stem err msg in dutch. . * why need to run -C mf twice? . * fix interstaff stuff @@ -21,8 +28,7 @@ everything works and matches up; when either is set just a bit above the default 5.0 (5.4 is what I was hoping to use), stems miss note heads. So it's some sort of a numerical (truncation/roundoff) problem. John -. * metre -> meter -. * Fixed size staff heights; +. * Fixed size staff/system heights; . * ly2dvi : don't repeat opus if same. . * breaks before mmrests are favored. . * hara kiri _8 clef. @@ -55,7 +61,6 @@ from which comes tons of confusion). It is usually notated as (again, using C as the root) Cdim7 or Co7. . * Mondrup: - - I would like the possibility of forcing clef- and key- changes to be printed _after_ the new bar line diff --git a/input/test/staff-line-leading.ly b/input/test/staff-line-leading.ly new file mode 100644 index 0000000000..03a5daf1d5 --- /dev/null +++ b/input/test/staff-line-leading.ly @@ -0,0 +1,8 @@ +\score { + \notes \relative c'' \context GrandStaff < + \context Staff = up { c4 c4 } + \context Staff = down { \property Staff. staffLineLeading = #5.5 c4 + + } +> +} diff --git a/input/test/stem-length.fly b/input/test/stem-length.fly new file mode 100644 index 0000000000..00718bc104 --- /dev/null +++ b/input/test/stem-length.fly @@ -0,0 +1,2 @@ + +g''4 \property Voice.stemLength = #14 g4 \property Voice.stemLength = #3 g4 g,,4 diff --git a/input/test/stem-length.ly b/input/test/stem-length.ly new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/input/test/stem-length.ly @@ -0,0 +1 @@ + diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index c28320f301..74967e7b66 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -86,7 +86,7 @@ Align_note_column_engraver::process_acknowledged () */ SCM grsp = get_property ("graceAccidentalSpace", 0); - if (SCM_NUMBERP(grsp)) + if (gh_number_p(grsp)) { /* ugh. diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 7caf691c79..c2d30f6d50 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -66,6 +66,13 @@ Auto_beam_engraver::consider_end_and_begin (Moment test_mom) if (test_mom.den () != 1) type_str = type_str + "_" + to_str (test_mom.den ()); + /* + URG + + FIXME: SHOULD USE ALIST + + */ + /* Determine end moment for auto beaming (and begin, mostly 0==anywhere) In order of increasing priority: @@ -203,24 +210,7 @@ Auto_beam_engraver::create_beam_p () beam_p->add_stem ((*stem_l_arr_p_)[i]); } - /* urg, copied from Beam_engraver */ - SCM prop = get_property ("beamslopedamping", 0); - if (SCM_NUMBERP(prop)) - beam_p->set_elt_property (damping_scm_sym, prop); - - prop = get_property ("autoKneeGap", 0); - if (SCM_NUMBERP(prop)) - beam_p->set_elt_property (auto_knee_gap_scm_sym, prop); - - prop = get_property ("autoInterstaffKneeGap", 0); - if (SCM_NUMBERP(prop)) - beam_p->set_elt_property (auto_interstaff_knee_gap_scm_sym, prop); - - prop = get_property ("beamquantisation", 0); - if (SCM_NUMBERP(prop)) - beam_p->quantisation_ = (Beam::Quantisation)(int)prop; - - announce_element (Score_element_info (beam_p, 0)); + return beam_p; } diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 5811e6dc86..92378ccbd8 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -49,11 +49,6 @@ Bar_engraver::create_bar () { bar_p_->set_elt_property (at_line_start_scm_sym, SCM_BOOL_T); } - prop = get_property ("barSize", 0); - if (SCM_NUMBERP(prop)) - { - bar_p_->set_elt_property (bar_size_scm_sym, prop); - } announce_element (Score_element_info (bar_p_, 0)); } } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 9db68461fb..2db31f2b91 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -33,7 +33,6 @@ Bar_number_engraver::do_process_requests () create_items (0); text_p_->text_str_ = to_str (time->bars_i_); - text_p_->style_str_ = "roman"; } } diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc index 12e94befc1..cf73f36500 100644 --- a/lily/bar-script-engraver.cc +++ b/lily/bar-script-engraver.cc @@ -45,7 +45,7 @@ Bar_script_engraver::do_creation_processing () */ void -Bar_script_engraver::do_acknowledge_element (Item *i) +Bar_script_engraver::attach_script_to_item (Item *i) { Axis other_axis = Axis((axis_ + 1)%2); if (staff_side_p_ && !staff_side_p_->parent_l(other_axis)) @@ -106,7 +106,7 @@ Bar_script_engraver::acknowledge_element (Score_element_info inf) if (inf.origin_trans_l_arr_.size () != 1) return; - do_acknowledge_element (i); + attach_script_to_item (i); } } @@ -154,7 +154,7 @@ Bar_script_engraver::create_items (Request *rq) staff_side_p_->set_victim(text_p_); SCM padding = get_property (type_ + "ScriptPadding", 0); - if (SCM_NUMBERP(padding)) + if (gh_number_p(padding)) { staff_side_p_->set_elt_property (padding_scm_sym, padding); } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 6022a0a578..99a7c00d28 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -99,21 +99,6 @@ Beam_engraver::do_process_requests () /* urg, must copy to Auto_beam_engraver too */ - SCM prop = get_property ("beamslopedamping", 0); - if (SCM_NUMBERP(prop)) - beam_p_->set_elt_property (damping_scm_sym, prop); - - prop = get_property ("autoKneeGap", 0); - if (SCM_NUMBERP(prop)) - beam_p_->set_elt_property (auto_knee_gap_scm_sym, prop); - - prop = get_property ("autoInterstaffKneeGap", 0); - if (SCM_NUMBERP(prop)) - beam_p_->set_elt_property (auto_interstaff_knee_gap_scm_sym, prop); - - prop = get_property ("beamquantisation", 0); - if (SCM_NUMBERP(prop)) - beam_p_->quantisation_ = (Beam::Quantisation)gh_scm2int(prop); announce_element (Score_element_info (beam_p_, reqs_drul_[START])); } diff --git a/lily/beam.cc b/lily/beam.cc index 83d83260ae..69de929231 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -41,7 +41,6 @@ Beam::Beam () { slope_f_ = 0; left_y_ = 0; - quantisation_ = NORMAL; multiple_i_ = 0; } @@ -283,34 +282,32 @@ Beam::get_default_dir () const Direction beam_dir; Direction neutral_dir = (Direction)(int)paper_l ()->get_var ("stem_default_neutral_direction"); - Dir_algorithm a = (Dir_algorithm)rint(paper_l ()->get_var ("beam_dir_algorithm")); - switch (a) + SCM a = get_elt_property (gh_symbol2scm ("beam_dir_algorithm")); + a= gh_cdr (a); + + if (a == gh_symbol2scm ("majority")) // should get default from paper. + beam_dir = (count[UP] == count[DOWN]) ? neutral_dir + : (count[UP] > count[DOWN]) ? UP : DOWN; + else if (a == gh_symbol2scm ("mean")) + // mean center distance + beam_dir = (total[UP] == total[DOWN]) ? neutral_dir + : (total[UP] > total[DOWN]) ? UP : DOWN; + else if (a == gh_symbol2scm ("median")) { - case MAJORITY: - beam_dir = (count[UP] == count[DOWN]) ? neutral_dir - : (count[UP] > count[DOWN]) ? UP : DOWN; - break; - case MEAN: - // mean center distance - beam_dir = (total[UP] == total[DOWN]) ? neutral_dir - : (total[UP] > total[DOWN]) ? UP : DOWN; - break; - default: - case MEDIAN: // median center distance - if (!count[DOWN] || !count[UP]) - { - beam_dir = (count[UP] == count[DOWN]) ? neutral_dir - : (count[UP] > count[DOWN]) ? UP : DOWN; - } - else - { + if (count[DOWN] && count[UP]) + { beam_dir = (total[UP] / count[UP] == total[DOWN] / count[DOWN]) ? neutral_dir - : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN; + : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN; + } + else + { + beam_dir = (count[UP] == count[DOWN]) ? neutral_dir + : (count[UP] > count[DOWN]) ? UP : DOWN; } - break; } + return beam_dir; } @@ -517,7 +514,10 @@ Beam::quantise_dy () + n * interline */ - if (quantisation_ <= NONE) + SCM q = get_elt_property (gh_symbol2scm ("slope_quantisation")); + q = gh_cdr (q); + + if (q == gh_symbol2scm ("none")) return; Real interline_f = stems_[0]->staff_line_leading_f (); @@ -532,7 +532,6 @@ Beam::quantise_dy () Real quanty_f = 0.0; - /* UGR. ICE in 2.8.1; bugreport filed. */ Array allowed_fraction (3); allowed_fraction[0] = 0; allowed_fraction[1] = (beam_f / 2 + staffline_f / 2); @@ -560,9 +559,8 @@ Beam::quantise_left_y (bool extend_b) we only need to quantise the start of the beam as dy is quantised too if extend_b then stems must *not* get shorter */ - - if (quantisation_ == NONE) - return; + SCM q = get_elt_property (gh_symbol2scm ("slope_quantisation")); + q = gh_cdr (q); /* ---------------------------------------------------------- @@ -607,7 +605,7 @@ Beam::quantise_left_y (bool extend_b) Real beamdy_f = beamdx_f * slope_f_ * internote_f; Array allowed_position; - if (quantisation_ <= NORMAL) + if (q == gh_symbol2scm ("normal")) { if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (straddle); @@ -615,9 +613,9 @@ Beam::quantise_left_y (bool extend_b) allowed_position.push (sit); allowed_position.push (hang); } - else - // TODO: check and fix TRADITIONAL + else if (q == gh_symbol2scm ("traditional")) { + // TODO: check and fix TRADITIONAL if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (straddle); if ((multiple_i_ <= 1) && (beamdy_f <= staffline_f / 2)) diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index 0fff51106f..923eeeab1e 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -23,7 +23,6 @@ Breathing_sign::Breathing_sign () { dir_ = UP; set_elt_property (breakable_scm_sym, SCM_BOOL_T); - set_elt_property (break_priority_scm_sym, gh_int2scm (-4)); set_elt_property (visibility_lambda_scm_sym, ly_ch_C_eval_scm ("non_postbreak_visibility")); } diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index d0005c8983..08d397b6f3 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -83,10 +83,6 @@ Chord_name_engraver::do_process_requests () item_p->text_str_ = chord.banter_str (inversion); - SCM style = get_property ("textStyle", 0); - if (gh_string_p (style)) - item_p->style_str_ = ly_scm2string (style); - text_p_arr_.push (item_p); announce_element (Score_element_info (item_p, 0)); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 68d96cef59..335ff0a62f 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -190,11 +190,6 @@ Clef_engraver::create_clef() if (!clef_p_) { Clef_item *c= new Clef_item; - c->set_elt_property (break_priority_scm_sym, gh_int2scm (-2)); // ugh - SCM clefstyle = get_property ("clefStyle", 0); - if (gh_string_p(clefstyle)) - c->set_elt_property (style_scm_sym, clefstyle); - announce_element (Score_element_info (c, clef_req_l_)); clef_p_ = c; } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 2919255e71..f203d39bae 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -60,7 +60,7 @@ Clef_item::do_add_processing () pscore_l_->typeset_element (g); g->text_str_ = "8"; - g->style_str_ = "italic"; + g->set_elt_property (style_scm_sym, gh_str02scm ("italic")); g->set_parent (this, Y_AXIS); g->set_parent (this, X_AXIS); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 2933131c8d..93dc2e7d5a 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -131,7 +131,7 @@ Dynamic_engraver::do_process_requests() } prop = get_property ("dynamicDirection", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { staff_side_p_->dir_ = to_dir (prop); } @@ -141,7 +141,7 @@ Dynamic_engraver::do_process_requests() } prop = get_property ("dynamicPadding", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { staff_side_p_->set_elt_property (padding_scm_sym, prop); } @@ -180,7 +180,7 @@ Dynamic_engraver::do_process_requests() to_end_ss_span_p_->dir_ = to_dir (prop); } prop = get_property ("dynamicPadding", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { to_end_ss_span_p_->set_elt_property (padding_scm_sym,prop); } diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index b8d91ae55c..4f706b34bf 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -13,7 +13,7 @@ Font_size_engraver::Font_size_engraver () { - size_i_ = 0; + size_ = SCM_EOL; } void @@ -21,20 +21,25 @@ Font_size_engraver::do_process_requests () { SCM s (get_property ("fontSize", 0)); - if (SCM_NUMBERP(s)) + if (gh_number_p(s)) { - size_i_ = gh_scm2int (s); + size_ = gh_scm2int (s); + } + else + { + size_ = SCM_EOL; } } void Font_size_engraver::acknowledge_element (Score_element_info e) { - if (size_i_ && e.elem_l_->get_elt_property (fontsize_scm_sym) == SCM_BOOL_F) + if (size_ != SCM_EOL + && e.elem_l_->get_elt_property (fontsize_scm_sym) == SCM_BOOL_F) { - e.elem_l_->set_elt_property (fontsize_scm_sym, - gh_int2scm (size_i_)); + e.elem_l_->set_elt_property (fontsize_scm_sym, size_); } } + ADD_THIS_TRANSLATOR (Font_size_engraver); diff --git a/lily/include/bar-script-engraver.hh b/lily/include/bar-script-engraver.hh index dec3c05ef6..a3642a29a6 100644 --- a/lily/include/bar-script-engraver.hh +++ b/lily/include/bar-script-engraver.hh @@ -31,7 +31,7 @@ protected: /** Put the script on #it# */ - void do_acknowledge_element (Item *it); + void attach_script_to_item (Item *it); /** Return non-nil if we want to hang something on this. */ diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 9e1cbb8346..de68f6f99c 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -23,6 +23,7 @@ damping: amount of beam slope damping. (int) should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams +slope_quantisation: 'none, 'normal or 'traditional */ class Beam : public Directional_spanner { @@ -44,11 +45,7 @@ public: /// position of leftmost end of beam Real left_y_; - /** should beam pos / slope be quantised? 0: no, 1: yes, 2: traditional - JUNKME. - */ - Quantisation quantisation_; - + /// maximum number of beams (for opening-up of beam-spacing) int multiple_i_; diff --git a/lily/include/font-size-engraver.hh b/lily/include/font-size-engraver.hh index 0edef5be86..d36ee64683 100644 --- a/lily/include/font-size-engraver.hh +++ b/lily/include/font-size-engraver.hh @@ -11,7 +11,7 @@ #define FONT_SIZE_GRAV_HH #include "engraver.hh" - +#include "protected-scm.hh" /** Set font size on elements that do not have a fontsize set yet. @@ -20,7 +20,7 @@ Writes element property fontsize */ class Font_size_engraver : public Engraver { - int size_i_; + Protected_scm size_; protected: virtual void acknowledge_element (Score_element_info); virtual void do_process_requests (); diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index 45644294ee..ee91b59f8a 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -14,6 +14,7 @@ #include "lily-proto.hh" #include "virtual-methods.hh" #include "dictionary.hh" +#include "scm-hash.hh" /** Definition of how to output mudela. @@ -25,6 +26,7 @@ public: Scope *scope_p_; Array filename_str_arr_; + Scheme_hash_table default_properties_; Music_output_def (Music_output_def const&); Music_output_def (); diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 8615d9cf86..f939347094 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -57,7 +57,6 @@ public: Real get_realvar (SCM symbol) const; Real get_var (String id) const; - SCM get_scm_var (SCM sym) const; void reinit (); Paper_def (); diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index a038db298e..5c44644c2e 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -33,6 +33,7 @@ static scm_sizet free_smob (SCM s); \ static int print_smob (SCM s, SCM p, scm_print_state*); \ static long smob_tag_; \ + static SCM equal_p (SCM a, SCM b);\ static void init_smobs(); \ void unsmobify_self ();\ void do_smobify_self();\ diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index 8b73e999bb..4e628f2787 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -19,9 +19,7 @@ class Text_item : public Item { public: String text_str_; - String style_str_; - Text_item (); VIRTUAL_COPY_CONS (Score_element); protected: virtual void do_print () const; diff --git a/lily/include/time-signature.hh b/lily/include/time-signature.hh index 771ff759af..39401cb208 100644 --- a/lily/include/time-signature.hh +++ b/lily/include/time-signature.hh @@ -27,8 +27,6 @@ protected: public: Time_signature () ; Array args_; - String time_sig_type_str_; - VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 00da2cd391..e1d91d1aea 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -38,8 +38,9 @@ class Translator_group : public virtual Translator { Cons_list trans_p_list_; public: - SCM get_property (String type_str, Translator_group **where_found_l) const; + SCM get_property (SCM name_sym, Translator_group **where_found_l) const; void set_property (String var_name, SCM value); + String id_str_; diff --git a/lily/include/translator.hh b/lily/include/translator.hh index ec0feb943f..598544b142 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -59,7 +59,10 @@ public: ask daddy for a feature */ Music_output_def *output_def_l () const; + SCM get_property (String, Translator_group **) const; + SCM get_property (SCM symbol, Translator_group **) const; + virtual Moment now_mom () const; protected: diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 51b56ca726..b42b34592e 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -109,7 +109,7 @@ ly_quote_scm (SCM s) SCM ly_symbol (String name) { - return gh_car (scm_intern ((char*)name.ch_C(), name.length_i())); + return gh_symbol2scm ((char*)name.ch_C()); } String diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 080546f2f5..f6b61316fa 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -44,10 +44,6 @@ Lyric_engraver::do_process_requests() text_p_->text_str_ = req_l_->text_str_; text_p_->text_str_ += " "; // ugh. - SCM style = get_property ("textStyle", 0); - if (gh_string_p(style)) - text_p_->style_str_ = ly_scm2string (style); - text_p_->set_elt_property (non_rhythmic_scm_sym, SCM_BOOL_T); announce_element (Score_element_info (text_p_, req_l_)); diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 1c4b966a4f..444bd2ffeb 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -46,7 +46,8 @@ Mark_engraver::do_process_requests () { create_items (mark_req_l_); text_p_->text_str_ = mark_req_l_->str_; - text_p_->style_str_ = text_p_->text_str_.index_any_i ("0123456789") >= 0 - ? "mark" : "Large"; + SCM st = gh_str02scm ((text_p_->text_str_.index_any_i ("0123456789") >= 0 ) + ? "mark" : "large"); + text_p_->set_elt_property (style_scm_sym, st); } } diff --git a/lily/moment.cc b/lily/moment.cc index 7b76747d73..94d65eab45 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -67,3 +67,12 @@ init_moments () } ADD_SCM_INIT_FUNC(moms,init_moments); + +SCM +Moment::equal_p (SCM a, SCM b) +{ + Moment *m1 = SMOB_TO_TYPE(Moment, a); + Moment *m2 = SMOB_TO_TYPE(Moment, b); + + return (*m1 == *m2) ? SCM_BOOL_T : SCM_BOOL_F; +} diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 99477e09d7..92c4b7ef98 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -73,12 +73,13 @@ Note_heads_engraver::do_process_requests() } note_p->position_i_ = note_req_l->pitch_.steps (); + /* + TODO: transparent note heads. + */ + if (gh_string_p (noteheadstyle)) { - if (ly_scm2string (noteheadstyle) == "transparent") - note_p->set_elt_property (transparent_scm_sym, SCM_BOOL_T); - else - note_p->set_elt_property (style_scm_sym, noteheadstyle); + note_p->set_elt_property (style_scm_sym, noteheadstyle); } Score_element_info itinf (note_p,note_req_l); diff --git a/lily/note-performer.cc b/lily/note-performer.cc index f455204067..25a49c2f85 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -38,7 +38,7 @@ Note_performer::do_process_requests () int transposing_i = 0; //urg SCM prop = get_property ("transposing", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) transposing_i = gh_scm2int (prop); while (note_req_l_arr_.size ()) diff --git a/lily/paper-def.cc b/lily/paper-def.cc index c5a9146f81..ead9c06ae5 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -54,33 +54,6 @@ Paper_def::Paper_def (Paper_def const&s) } } -SCM -Paper_def::get_scm_var (SCM s) const -{ - if (!scope_p_->elem_b (s)) - return SCM_BOOL_F; - - Identifier * id = scope_p_->elem (s); - - SCM z; - SCM_NEWCELL (z); - SCM_SETCAR(z, s); - - SCM val; - - if (dynamic_cast (id)) - { - Real r = *id->access_content_Real (false); - val = gh_double2scm (r); - } - else - { - return SCM_BOOL_F; - } - - SCM_SETCDR(z,val); - return z; -} Real Paper_def::get_var (String s) const diff --git a/lily/parser.yy b/lily/parser.yy index c5b3927e59..fb8e92a65e 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -550,7 +550,13 @@ paper_def_body: $$->set_lookup ($2, l); } | paper_def_body assignment semicolon { - + + } + | paper_def_body SCM_T '=' SCM_T { + if (!gh_symbol_p ($2)) + THIS->parser_error ("expect a symbol as lvalue"); + else + $$->default_properties_[$2] = $4; } | paper_def_body translator_spec_block { $$->assign_translator ($2); diff --git a/lily/property-engraver.cc b/lily/property-engraver.cc new file mode 100644 index 0000000000..1ff12820ff --- /dev/null +++ b/lily/property-engraver.cc @@ -0,0 +1,74 @@ +/* + property-engraver.cc -- implement Property engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include "lily-guile.hh" +#include "engraver.hh" +#include "protected-scm.hh" +#include "dictionary.hh" +#include "score-element.hh" + +class Property_engraver : public Engraver +{ + Dictionary prop_dict_; + void apply_properties (SCM, Score_element*); + +protected: + virtual void acknowledge_element (Score_element_info ei); + virtual void do_creation_processing (); + + VIRTUAL_COPY_CONS(Translator); +}; + +void +Property_engraver::do_creation_processing () +{ + SCM plist = get_property ("Generic_property_list", 0); + for (; SCM_NIMP (plist); plist = gh_cdr (plist)) + { + SCM elt_props = gh_car (plist); + prop_dict_[ly_scm2string (gh_car (elt_props))] = gh_cdr (elt_props); + } +} + +void +Property_engraver::acknowledge_element (Score_element_info i) +{ + if (prop_dict_.elem_b (i.elem_l_->name())) + { + SCM p = prop_dict_[i.elem_l_->name()]; + apply_properties (p,i.elem_l_); + } + if (prop_dict_.elem_b ("all")) + { + apply_properties (prop_dict_["all"], i.elem_l_); + } +} + +void +Property_engraver::apply_properties (SCM p, Score_element *e) +{ + for (; SCM_NIMP (p); p = gh_cdr (p)) + { + SCM entry = gh_car (p); + SCM prop_sym = gh_car (entry); + SCM type_p = gh_cadr (entry); + SCM elt_prop_name = gh_caddr (entry); + + if (e->get_elt_property (elt_prop_name) != SCM_BOOL_F) + continue; + + SCM val = get_property (prop_sym, 0); + if (val != SCM_UNDEFINED + && gh_apply (type_p, scm_listify (val, SCM_UNDEFINED)) + == SCM_BOOL_T) + e->set_elt_property (elt_prop_name, val); + } +} + +ADD_THIS_TRANSLATOR(Property_engraver); diff --git a/lily/property-inspect.cc b/lily/property-inspect.cc index 5e29f4160b..57093f8bce 100644 --- a/lily/property-inspect.cc +++ b/lily/property-inspect.cc @@ -12,7 +12,7 @@ bool isdir_b (SCM s) { - if (SCM_NUMBERP (s)) + if (gh_number_p (s)) { int i = gh_int2scm (s); return i>= -1 && i <= 1; diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 939baa2161..dde03daa1c 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -56,12 +56,7 @@ Rest_engraver::do_process_requests () dot_p_->dots_i_ = rest_req_l_->duration_.dots_i_; announce_element (Score_element_info (dot_p_,0)); } - if (rest_p_->balltype_i_ >= 2) - { - SCM reststyle = get_property ("restStyle", 0); - if (gh_string_p (reststyle)) - rest_p_->set_elt_property (style_scm_sym,reststyle); - } + announce_element (Score_element_info (rest_p_, rest_req_l_)); } } diff --git a/lily/rest.cc b/lily/rest.cc index daa9ceb5dd..14e10a3537 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -52,7 +52,7 @@ Rest::do_brew_molecule_p () const String style; SCM style_sym =get_elt_property (style_scm_sym); - if (style_sym != SCM_BOOL_F) + if (balltype_i_ >= 2 && style_sym != SCM_BOOL_F) { style = ly_scm2string (SCM_CDR(style_sym)); } diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 914a2c2ecf..5862e6f790 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -107,18 +107,6 @@ Rhythmic_column_engraver::do_pre_move_processing() { if (ncol_p_) { - SCM sh = get_property ("horizontalNoteShift", 0); - if (SCM_NUMBERP(sh)) - { - ncol_p_->set_elt_property (horizontal_shift_scm_sym, sh); - } - - sh = get_property ("forceHorizontalShift" ,0); - if (SCM_NUMBERP(sh)) - { - ncol_p_->set_elt_property (force_hshift_scm_sym, sh); - } - typeset_element (ncol_p_); ncol_p_ =0; } diff --git a/lily/score-element.cc b/lily/score-element.cc index a8a82a8a87..487a6c0d56 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -93,10 +93,17 @@ Score_element::get_elt_property (SCM sym) const SCM s = scm_assq(sym, element_property_alist_); // is this a good idea? - if (s == SCM_BOOL_F && pscore_l_ && pscore_l_->paper_l_) - s = pscore_l_->paper_l_->get_scm_var (sym); + if (s != SCM_BOOL_F) + return s; - return s; + if (pscore_l_) + { + // should probably check for Type::sym as well. + if (pscore_l_->paper_l_->default_properties_.elem_b (sym)) + return pscore_l_->paper_l_->default_properties_[sym]; + } + + return SCM_BOOL_F; } SCM @@ -464,3 +471,9 @@ Score_element::do_smobify_self () } #include "ly-smobs.icc" IMPLEMENT_SMOBS(Score_element); + +SCM +Score_element::equal_p (SCM a, SCM b) +{ + return SCM_CDR(a) == SCM_CDR(b) ? SCM_BOOL_T : SCM_BOOL_F; +} diff --git a/lily/score-priority-engraver.cc b/lily/score-priority-engraver.cc index 3530c26a25..c72a60d01f 100644 --- a/lily/score-priority-engraver.cc +++ b/lily/score-priority-engraver.cc @@ -44,8 +44,8 @@ Score_priority_engraver::acknowledge_element (Score_element_info inf) if (item_l->empty_b (X_AXIS) || item_l->parent_l (X_AXIS)) return; - bool breakable - = (item_l->remove_elt_property (breakable_scm_sym) != SCM_BOOL_F); + SCM bp=item_l->remove_elt_property (breakable_scm_sym); + bool breakable = (bp != SCM_BOOL_F); if (!breakable) return ; diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index ae2dfa312e..f7657e676f 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -71,14 +71,14 @@ Script_engraver::do_process_requests() ss->dir_ = (Direction)force_dir; SCM dir_prop (get_property ("articulationScriptVerticalDirection", 0)); - if (SCM_NUMBERP(dir_prop)) + if (gh_number_p(dir_prop)) ss->dir_ = to_dir (dir_prop); if (l->dir_) ss->dir_ = l->dir_; SCM paddingprop = get_property ("articulationScriptPadding", 0); - if (SCM_NUMBERP(paddingprop)) + if (gh_number_p(paddingprop)) { ss->set_elt_property (padding_scm_sym, paddingprop); } @@ -92,7 +92,7 @@ Script_engraver::do_process_requests() p->set_staff_side (ss); ss->set_elt_property (script_priority_scm_sym, priority); - if (SCM_NUMBERP (paddingprop)) + if (gh_number_p (paddingprop)) ss->set_elt_property (padding_scm_sym, paddingprop); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 35e24dab23..41be6e3180 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -32,7 +32,7 @@ void Separating_line_group_engraver::do_removal_processing () { SCM sz (get_property ("postBreakPadding", 0)); - if (SCM_NUMBERP(sz)) + if (gh_number_p(sz)) { sep_span_p_->padding_f_ = Real(sz); } diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 0ac32e8d34..045373378d 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -91,10 +91,6 @@ Slur_engraver::do_process_requests() // push a new slur onto stack. //(use temp. array to wait for all slur STOPs) Slur * s_p =new Slur; - SCM prop = get_property ("slurDash", 0); - if (SCM_NUMBERP(prop)) - s_p->set_elt_property (dashed_scm_sym, prop); - requests_arr_.push (slur_req_l); start_slur_l_arr_.push (s_p); @@ -112,7 +108,7 @@ Slur_engraver::do_pre_move_processing() SCM dir2 (get_property ("verticalDirection", 0)); Direction slurdir = CENTER; - if (SCM_NUMBERP(dir)) + if (gh_number_p(dir)) slurdir = to_dir (dir); else if (gh_number_p (dir2)) slurdir = to_dir (dir2); diff --git a/lily/slur.cc b/lily/slur.cc index 9e3b16d827..8f04b9fa76 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -280,9 +280,6 @@ Slur::do_post_processing () Now we've got a fine slur Catch and correct some ugly cases */ - - - String infix = interstaff_b ? "interstaff_" : ""; Real height_damp_f = paper_l ()->get_var ("slur_"+infix +"height_damping"); Real slope_damp_f = paper_l ()->get_var ("slur_"+infix +"slope_damping"); diff --git a/lily/staff-margin-engraver.cc b/lily/staff-margin-engraver.cc index bddeeb9543..7fdba6a601 100644 --- a/lily/staff-margin-engraver.cc +++ b/lily/staff-margin-engraver.cc @@ -48,18 +48,17 @@ Staff_margin_engraver::acknowledge_element (Score_element_info inf) long_name = short_name; if (gh_string_p (long_name)) - return; - - create_items (0); - text_p_->text_str_ = ly_scm2string (long_name); - staff_side_p_->dir_ = LEFT; - Bar_script_engraver::do_acknowledge_element (i); + { + create_items (0); + text_p_->text_str_ = ly_scm2string (long_name); + staff_side_p_->dir_ = LEFT; + Bar_script_engraver::attach_script_to_item (i); - /* + /* UGH. ignores font size settings. */ - Interval iv(text_p_->extent (Y_AXIS)); - text_p_->translate_axis (- iv.center (), Y_AXIS); + Interval iv(text_p_->extent (Y_AXIS)); + text_p_->translate_axis (- iv.center (), Y_AXIS); + } } - diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 853af03f63..1ec7d19054 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -96,10 +96,10 @@ String Staff_performer::new_instrument_str () { // mustn't ask Score for instrument: it will return piano! - SCM minstr = get_property ("midiInstrument", 0); + SCM minstr = get_property (gh_symbol2scm ("midiInstrument"), 0); if (!gh_string_p(minstr)) - minstr = get_property ("instrument", 0); + minstr = get_property (gh_symbol2scm ("instrument"), 0); if (ly_scm2string (minstr) == instrument_str_) return ""; diff --git a/lily/staff-sym-engraver.cc b/lily/staff-sym-engraver.cc index 93e41b28ab..a326789009 100644 --- a/lily/staff-sym-engraver.cc +++ b/lily/staff-sym-engraver.cc @@ -35,13 +35,13 @@ void Staff_symbol_engraver::do_removal_processing() { SCM l (get_property ("numberOfStaffLines", 0)); - if (SCM_NUMBERP(l)) + if (gh_number_p(l)) { span_p_->no_lines_i_ = gh_scm2int (l); } SCM sz (get_property ("staffLineLeading", 0)); - if (SCM_NUMBERP(sz)) + if (gh_number_p(sz)) { span_p_->staff_line_leading_f_ = gh_scm2double (sz); } diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index d48fa3925f..edd978df5e 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -29,7 +29,7 @@ void Stem_engraver::do_creation_processing () { SCM prop = get_property ("abbrev", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { default_abbrev_i_ = gh_scm2int (prop); } @@ -97,7 +97,7 @@ Stem_engraver::do_pre_move_processing() if (stem_p_) { SCM prop = get_property ("verticalDirection", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { stem_p_->dir_ = to_dir (prop); stem_p_->set_elt_property (dir_forced_scm_sym, SCM_BOOL_T); @@ -105,36 +105,17 @@ Stem_engraver::do_pre_move_processing() Translator_group* which; prop = get_property ("stemLeftBeamCount", &which); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { stem_p_->beams_i_drul_[LEFT] = gh_scm2int (prop); ((Translator_group*)which)->set_property ("stemLeftBeamCount", SCM_UNDEFINED); } prop = get_property ("stemRightBeamCount", &which); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) { stem_p_->beams_i_drul_[RIGHT] = gh_scm2int (prop); ((Translator_group*)which)->set_property ("stemRightBeamCount", SCM_UNDEFINED); } - - prop = get_property ("stemLength", 0); - if (SCM_NUMBERP(prop)) - { - stem_p_->set_elt_property (length_scm_sym, prop); - } - - prop = get_property ("stemStyle", 0); - if (gh_string_p (prop)) - { - stem_p_->set_elt_property (style_scm_sym, prop); - } - - prop = get_property ("noStemExtend", 0); - if (gh_boolean_p (prop) && gh_scm2bool (prop)) - { - stem_p_->set_elt_property (no_stem_extend_scm_sym, prop); - } - typeset_element(stem_p_); stem_p_ = 0; } diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 9ecc46f434..a2bd014612 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -98,21 +98,9 @@ Text_engraver::do_process_requests () text->text_str_ = r->text_str_; - if (r->style_str_.empty_b ()) - { - SCM p (get_property ("textStyle", 0)); - if (gh_string_p (p)) - text->style_str_ = ly_scm2string(p); - } - else - text->style_str_ = r->style_str_; + if (r->style_str_.length_i ()) + text->set_elt_property (style_scm_sym, ly_ch_C_to_scm (r->style_str_.ch_C())); - SCM padding = get_property ("textScriptPadding", 0); - if (SCM_NUMBERP(padding)) - { - ss->set_elt_property (padding_scm_sym, padding); - } - SCM empty = get_property ("textEmptyDimension", 0); if (gh_boolean_p (empty) && gh_scm2bool (empty)) { diff --git a/lily/text-item.cc b/lily/text-item.cc index 6cc6437297..eeaf40c30a 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -16,16 +16,14 @@ Molecule* Text_item::do_brew_molecule_p () const { - Molecule a= paper_l ()->lookup_l(0)->text (style_str_,text_str_, paper_l ()); + SCM style = get_elt_property (style_scm_sym); + String st = (style == SCM_BOOL_F) ? "" : ly_scm2string (gh_cdr (style)); + + Molecule a= paper_l ()->lookup_l(0)->text (st, text_str_, paper_l ()); return new Molecule (a); } -Text_item::Text_item () -{ - style_str_ = "roman"; -} - void Text_item::do_print () const { diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 946f8e9367..a3ba0358ca 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -140,7 +140,7 @@ Tie_engraver::do_pre_move_processing () SCM dir2 (get_property ("verticalDirection", 0)); Direction tie_dir = CENTER; - if (SCM_NUMBERP(dir)) + if (gh_number_p(dir)) tie_dir = to_dir (dir); else if (isdir_b (dir2)) tie_dir = to_dir (dir2); diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index d9051d59ae..f680885064 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -54,11 +54,6 @@ Time_signature_engraver::do_pre_move_processing() { if (time_signature_p_) { - SCM sigstyle = get_property ("timeSignatureStyle", 0); - if (gh_string_p (sigstyle)) - { - time_signature_p_->time_sig_type_str_ = ly_scm2string (sigstyle); - } typeset_element (time_signature_p_); time_signature_p_ =0; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index a4960abc7b..1f6234cd9c 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -21,16 +21,19 @@ Time_signature::Time_signature () Molecule* Time_signature::do_brew_molecule_p () const { - if (time_sig_type_str_.length_i ()) + SCM st = get_elt_property (style_scm_sym); + + if (st != SCM_BOOL_F) { - if (time_sig_type_str_[0]=='1') + String style (ly_scm2string (gh_cdr (st))); + if (style[0]=='1') { Array tmparr = args_; return new Molecule( lookup_l ()->time_signature (args_[0], 0, paper_l ())); } else { - return new Molecule( lookup_l ()-> special_time_signature (time_sig_type_str_ ,args_[0], args_[1], paper_l ())); + return new Molecule( lookup_l ()-> special_time_signature (style, args_[0], args_[1], paper_l ())); } } else diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 82ab9dc0be..03479ed5b8 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -95,7 +95,7 @@ Timing_translator::do_process_requests() Translator_group * tr=0; SCM barn = get_property ("currentBarNumber", &tr); - if (SCM_NUMBERP(barn)) + if (gh_number_p(barn)) { time_.bars_i_ = gh_scm2int (barn); tr->set_property ("currentBarNumber", SCM_UNDEFINED); diff --git a/lily/translator-group.cc b/lily/translator-group.cc index cffdaf8905..f74aef58d4 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -448,10 +448,8 @@ Translator_group::do_add_processing () } SCM -Translator_group::get_property (String id, - Translator_group **where_l) const +Translator_group::get_property (SCM sym, Translator_group **where_l) const { - SCM sym = ly_symbol (id); if (properties_dict_.elem_b (sym)) { if (where_l) @@ -460,7 +458,7 @@ Translator_group::get_property (String id, } if (daddy_trans_l_) - return daddy_trans_l_->get_property (id, where_l); + return daddy_trans_l_->get_property (sym, where_l); if (where_l) *where_l = 0; diff --git a/lily/translator.cc b/lily/translator.cc index 218a8c1423..c70b629ce8 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -166,7 +166,14 @@ Translator::output_def_l () const SCM Translator::get_property (String id, Translator_group **where_l) const { - return daddy_trans_l_->get_property (id, where_l); + return daddy_trans_l_->get_property (ly_symbol (id), where_l); +} + +SCM +Translator::get_property (SCM sym, + Translator_group **where_l) const +{ + return daddy_trans_l_->get_property (sym, where_l); } diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index ce9c2cd2de..b9e3cf16dc 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -40,7 +40,7 @@ Tuplet_engraver::do_process_requests () dir = to_dir (prop); int visibility = 3; prop = get_property ("tupletVisibility", 0); - if (SCM_NUMBERP(prop)) + if (gh_number_p(prop)) visibility = gh_scm2int (prop); // bool ? for (int i= started_span_p_arr_.size (); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 2497fd4f59..48935c674c 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -33,13 +33,13 @@ void Vertical_align_engraver::do_removal_processing() { SCM dist (get_property ("maxVerticalAlign", 0)); - if (SCM_NUMBERP(dist)) + if (gh_number_p(dist)) { valign_p_->threshold_interval_[BIGGER] = gh_scm2double (dist); } dist = get_property ("minVerticalAlign", 0); - if (SCM_NUMBERP(dist)) + if (gh_number_p(dist)) { valign_p_->threshold_interval_[SMALLER] = gh_scm2double (dist); } diff --git a/ly/declarations.ly b/ly/declarations.ly index 5643839893..e7b6eac287 100644 --- a/ly/declarations.ly +++ b/ly/declarations.ly @@ -3,6 +3,8 @@ breve = \duration { -1 0 } longa = \duration { -2 0 } +#(eval-string (ly-gulp-file "generic-property.scm")) + \include "nederlands.ly" % dutch \include "chord-modifiers.ly" \include "script.ly" diff --git a/ly/engraver.ly b/ly/engraver.ly index b323524d32..c1687a847d 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -5,9 +5,12 @@ StaffContext=\translator { \type "Engraver_group_engraver"; \name Staff ; + barAuto = ##t voltaVisibility = ##t - + Generic_property_list = #generic-staff-properties + \consists "Property_engraver"; + \consists "Multi_measure_rest_engraver"; \consists "Bar_engraver"; % Bar_engraver must be first so default bars aren't overwritten @@ -66,6 +69,9 @@ StaffContext=\translator { RhythmicStaffContext=\translator{ \type "Engraver_group_engraver"; numberOfStaffLines = #1 + \consists "Property_engraver"; + + Generic_property_list = #generic-staff-properties barSize = \staffheight; \consists "Pitch_squash_engraver"; @@ -81,12 +87,16 @@ RhythmicStaffContext=\translator{ }; \translator{\RhythmicStaffContext} VoiceContext = \translator { + \type "Engraver_group_engraver"; dynamicPadding = #5.0 + Generic_property_list = #generic-voice-properties + + \consists "Dynamic_engraver"; % must come before text_engraver. \name Voice ; - -% \consists "Tie_engraver"; + \consists "Property_engraver"; + \consists "Breathing_sign_engraver"; \consists "Rest_engraver"; \consists "Dot_column_engraver"; @@ -95,9 +105,7 @@ VoiceContext = \translator { \consists "Auto_beam_engraver"; \include "auto-beam-settings.ly"; \consists "Chord_tremolo_engraver"; -% \consists "Multi_measure_rest_engraver"; - % ugh. Order matters here. \consists "Melisma_engraver"; textScriptPadding = #3.0 \consists "Text_engraver"; @@ -117,6 +125,9 @@ VoiceContext = \translator { GraceContext=\translator { \type "Grace_engraver_group"; \name "Grace"; + + Generic_property_list = #generic-grace-properties + \consists "Note_heads_engraver"; \consists "Local_key_engraver"; \consists "Stem_engraver"; @@ -126,13 +137,16 @@ GraceContext=\translator { \consists "Auto_beam_engraver"; \include "auto-beam-settings.ly"; \consists "Align_note_column_engraver"; - \consists "Font_size_engraver"; + \consists "Rhythmic_column_engraver"; \consists "Dynamic_engraver"; + \consists "Property_engraver"; + stemStyle = #"grace" weAreGraceContext = ##t fontSize = #-1 + stemLength = #6.0 verticalDirection = \up ; graceAccidentalSpace= 1.5 * \interline; @@ -143,7 +157,9 @@ GraceContext=\translator { ThreadContext = \translator{ \type Engraver_group_engraver; - \consists "Note_heads_engraver" ; + \consists "Note_heads_engraver" ; + Generic_property_list = #generic-thread-properties + \consists "Property_engraver"; \name Thread; }; @@ -289,6 +305,9 @@ ScoreContext = \translator { \accepts "GrandStaff"; \accepts "ChoirStaff"; \accepts "PianoStaff"; + + clefBreakPriority = #-2 + breathingSignBreakPriority = #-4 }; \translator { \ScoreContext } diff --git a/ly/params.ly b/ly/params.ly index a3e0eba66c..beb538c9b4 100644 --- a/ly/params.ly +++ b/ly/params.ly @@ -97,6 +97,10 @@ MAJORITY = 2.0; MEAN = 3.0; MEDIAN = 4.0; +#'beam_dir_algorithm = #'majority +#'slope_quantisation = #'normal + + %{ dit(code(beam_dir_algorithm)) Specify algorithm for determining whether beams go up or down. It is real valued. If set to 2.0 then diff --git a/scm/generic-property.scm b/scm/generic-property.scm new file mode 100644 index 0000000000..a895d3ba13 --- /dev/null +++ b/scm/generic-property.scm @@ -0,0 +1,96 @@ + +(define generic-beam-properties + (cons "Beam" + (list + (list 'beamslopedamping number? 'damping) + (list 'autoKneeGap number? 'auto_knee_gap) + (list 'autoInterstaffKneeGap number? 'auto_interstaff_knee_gap) + (list 'beamQuantisation symbol? 'slope_quantisation) + (list 'beamDirAlgorithm symbol? 'beam_dir_algorithm) + ) + ) + ) + + +(define generic-stem-properties + (cons "Stem" + (list + (list 'stemLength number? 'length) + (list 'stemStyle string? 'style) + (list 'noStemExtend boolean? 'no_stem_extend) + )) + ) + +(define generic-text-properties + (cons "Text_item" (list + (list 'textStyle string? 'style) + (list 'textScriptPadding number? 'padding) + ) + )) + +(define generic-bar-properties + (cons "Staff_bar" (list + (list 'barSize number? 'bar_size)) + ) + ) +(define generic-breathing-sign-properties + (cons "Breathing_sign" + (list + (list 'breathingSignBreakPriority number? 'break_priority + )))) + +(define generic-clef-properties + (cons "Clef_item" + (list + (list 'clefBreakPriority number? 'break_priority) + (list 'clefStyle string? 'style)) + ) + ) + +(define generic-All-properties + (cons "all" (list (list 'fontSize number? 'fontsize)))) + +(define generic-rest-properties + (cons "Rest" (list (list 'restStyle string? 'reststyle)))) + +(define generic-note-column-properties + (cons "Note_column" + (list + (list 'horizontalNoteShift number? 'horizontal_shift) + (list 'forceHorizontalShift number? 'force_hshift) + ))) + +(define generic-slur-properties + (cons "Slur" + (list + (list 'slurDash number? 'dashed)))) + +(define generic-timesig-properties + (cons "Time_signature" + (list + (list 'timeSignatureStyle string? 'sigstyle)))) + +(define generic-voice-properties + (list + generic-stem-properties + generic-rest-properties + generic-slur-properties + generic-beam-properties + generic-text-properties + generic-note-column-properties + generic-All-properties + )) + +(define generic-grace-properties generic-voice-properties) +(define generic-staff-properties + (list + generic-bar-properties + generic-timesig-properties + generic-clef-properties + generic-All-properties + ) + ) + +(define generic-thread-properties + (list generic-All-properties)) +