From 36a6f2b9ff4c934b385fde74d1506d30da6b2fb8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 12 Oct 2000 23:00:18 +0200 Subject: [PATCH] patch::: 1.3.95.jcn4 1.3.95.jcn4 =========== * Clef-engraver: changed c0-position, clef-position and glyph into properties, enabling ottava spanners: input/test/ottava.ly. --- CHANGES | 6 ++ VERSION | 2 +- input/les-nereides.ly | 24 +++++-- input/test/ottava.ly | 19 +++++ input/test/text-spanner.ly | 4 ++ lily/arpeggio-engraver.cc | 5 +- lily/arpeggio.cc | 2 +- lily/clef-engraver.cc | 123 +++++++++++++++++---------------- lily/span-arpeggio-engraver.cc | 4 +- lily/span-arpeggio.cc | 13 +++- lily/text-spanner-engraver.cc | 1 + ps/lily.ps | 11 +++ 12 files changed, 141 insertions(+), 73 deletions(-) create mode 100644 input/test/ottava.ly diff --git a/CHANGES b/CHANGES index b3be90fe66..acde60e03b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1.3.95.jcn4 +=========== + +* Clef-engraver: changed c0-position, clef-position and glyph into properties, + enabling ottava spanners: input/test/ottava.ly. + 1.3.95.jcn3 =========== diff --git a/VERSION b/VERSION index 32cd43fb7a..9df76a8503 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=95 -MY_PATCH_LEVEL=jcn3 +MY_PATCH_LEVEL=jcn4 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 29a797ac7f..79a08e0f8e 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -54,9 +54,13 @@ treble = \context Voice=treble \notes\relative c''{ \translator Staff=treble \property Voice.Slur \pop #'direction \property Voice.Slur \push #'direction = #1 - %% 8va \property PianoStaff.connectArpeggios = ##t - cis''''4^"m.g."\arpeggio ( + \property Voice.TextSpanner \pop #'type + \property Voice.TextSpanner \push #'type = #"dotted-line" + \property Voice.TextSpanner \push #'edge-height = #'(0 . 1.5) + \property Voice.TextSpanner \push #'edge-text = #'("8va " . "") + \property Staff."c0-position" = #-13 + cis''''4^"m.g."\arpeggio \spanrequest \start "text" ( #ifndef FAKE_GRACE @@ -70,9 +74,12 @@ treble = \context Voice=treble \notes\relative c''{ \property Grace.Stem \pop #'direction \property Grace.Stem \push #'direction = #0 \property Grace.Beam \push #'space-function = #grace-beam-space-function - %urg, dim. during grace dumps core here - %%[a16-5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2] - [a16-5( fis dis] [cis32 a-1 fis-4 dis] [cis a )fis-2] + %% urg, dim. during grace dumps core here + %% [a16-5( fis dis \spanrequest \stop "text" ] + %% [cis'32 a-1 fis-4 dis] [cis a )fis-2] + [a16-5( fis dis \spanrequest \stop "text" ] + \property Staff."c0-position" = #-6 + [cis32 a-1 fis-4 dis] [cis a )fis-2] } #else % FAKE_GRACE @@ -88,8 +95,11 @@ treble = \context Voice=treble \notes\relative c''{ )cis16 \property Voice.Stem \pop #'direction \property Voice.Stem \push #'direction = #0 - %%[a16^5( fis dis] [cis'32 a-1 fis-4 dis] [cis a )fis-2] s s s - [a16^5( fis dis] [cis32 a^1 fis^4 dis] [cis a )fis-2] s % s s + %% [a16^5( fis dis \spanrequest \stop "text" ] + %% [cis'32 a-1 fis-4 dis] [cis a )fis-2] s s s + [a16^5( fis dis \spanrequest \stop "text" ] + \property Staff."c0-position" = #-6 + [cis32 a^1 fis^4 dis] [cis a )fis-2] s % s s \property Voice.NoteHead \pop #'font-size \property Voice.Stem \pop #'font-size diff --git a/input/test/ottava.ly b/input/test/ottava.ly new file mode 100644 index 0000000000..e51a4c3b1c --- /dev/null +++ b/input/test/ottava.ly @@ -0,0 +1,19 @@ +\score{ + \notes\relative c'''{ + \property Voice.TextSpanner \pop #'type + \property Voice.TextSpanner \push #'type = #"dotted-line" + \property Voice.TextSpanner \push #'edge-height = #'(0 . 1.5) + \property Voice.TextSpanner \push #'edge-text = #'("8va " . "") + \property Staff."c0-position" = #-13 + + a\spanrequest \start "text" b c a \spanrequest \stop "text" + + \property Staff."c0-position" = #-6 + a b c a + + \property Staff."c0-position" = #1 + \property Voice.TextSpanner \push #'edge-text = #'("8bass " . "") + \property Voice.TextSpanner \push #'direction = #-1 + a\spanrequest \start "text" b c a \spanrequest \stop "text" + } +} diff --git a/input/test/text-spanner.ly b/input/test/text-spanner.ly index 7746b7c3ba..998e9d0851 100644 --- a/input/test/text-spanner.ly +++ b/input/test/text-spanner.ly @@ -18,10 +18,14 @@ b c a \spanrequest \stop "text" + + \property Staff."c0-position" = #-13 + \property Voice.TextSpanner \push #'dash-length = #5 \property Voice.TextSpanner \push #'line-thickness = #10 a \spanrequest \start "text" b c a \spanrequest \stop "text" + \property Staff."c0-position" = #-6 } } diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 3c9504512e..f9a2ee65bb 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -82,15 +82,16 @@ Arpeggio_engraver::process_acknowledged () arpeggio_->set_parent (stems_[0], Y_AXIS); Side_position::set_axis (arpeggio_, X_AXIS); Side_position::set_direction (arpeggio_, LEFT); + Staff_symbol_referencer::set_interface (arpeggio_); Pointer_group_interface pgi (arpeggio_, "stems"); for (int i = 0; i < stems_.size (); i++) { pgi.add_element (stems_[i]); - Side_position::add_support (arpeggio_, stems_[i]); + //Side_position::add_support (arpeggio_, stems_[i]); } for (int i = 0; i < supports_.size (); i++) { - Side_position::add_support (arpeggio_, supports_[i]); + ;//Side_position::add_support (arpeggio_, supports_[i]); } announce_element (arpeggio_, arpeggio_req_); } diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 1e7253645c..b974768b0e 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -42,7 +42,7 @@ Arpeggio::brew_molecule (SCM smob) a.translate_axis (i * staff_space, Y_AXIS); mol.add_molecule (a); } - mol.translate (Offset (-2 * staff_space, 0)); + // mol.translate (Offset (-2 * staff_space, 0)); return mol.create_scheme (); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 8544562006..97cbe20492 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -27,41 +27,36 @@ /// where is c-0 in the staff? class Clef_engraver : public Engraver { +public: + VIRTUAL_COPY_CONS (Translator); + Clef_engraver (); + + Direction octave_dir_; + bool first_b_; + +protected: + virtual void do_process_music (); + virtual void do_pre_move_processing (); + virtual void do_creation_processing (); + virtual void do_post_move_processing (); + virtual bool do_try_music (Music*); + virtual void acknowledge_element (Score_element_info); + +private: Item * clef_p_; Item * octavate_p_; Clef_change_req * clef_req_l_; - void create_clef(); + void create_clef (); bool set_type (String); -protected: - virtual void do_process_music(); - virtual void do_pre_move_processing(); - virtual void do_creation_processing(); - virtual void do_post_move_processing(); - virtual bool do_try_music (Music*); - virtual void acknowledge_element (Score_element_info); -public: - VIRTUAL_COPY_CONS(Translator); - int c0_position_i_; - int clef_position_i_; - // junkme. - Direction octave_dir_; - SCM clef_glyph_; // no need for protection. Always referenced somewhere else. - - Clef_engraver(); - - bool first_b_; }; -Clef_engraver::Clef_engraver() +Clef_engraver::Clef_engraver () { first_b_ = true; - clef_glyph_ = SCM_EOL; clef_p_ = 0; clef_req_l_ = 0; - c0_position_i_ = 0; - clef_position_i_ = 0; octave_dir_ = CENTER; octavate_p_ = 0; } @@ -69,15 +64,15 @@ Clef_engraver::Clef_engraver() bool Clef_engraver::set_type (String s) { - if (s.right_str(2) == "_8") // Down one octave + if (s.right_str (2) == "_8") // Down one octave { octave_dir_ = DOWN; - s = s.left_str(s.length_i() - 2); + s = s.left_str (s.length_i () - 2); } - else if (s.right_str(2) == "^8") // Up one octave + else if (s.right_str (2) == "^8") // Up one octave { octave_dir_ = UP; - s = s.left_str(s.length_i() - 2); + s = s.left_str (s.length_i () - 2); } else octave_dir_ = CENTER; @@ -87,32 +82,40 @@ Clef_engraver::set_type (String s) if (gh_list_p (c)) { - SCM found = scm_assoc (ly_str02scm (s.ch_C()), c); + SCM found = scm_assoc (ly_str02scm (s.ch_C ()), c); if (found == SCM_BOOL_F) return false; - clef_glyph_ = gh_cadr (found); - SCM pos = gh_caddr (found); + SCM glyph = gh_cadr (found); + SCM pos = gh_caddr (found); - clef_position_i_ = gh_scm2int (pos); + daddy_trans_l_->set_property ("glyph", glyph); + daddy_trans_l_->set_property ("position", pos); - found = scm_assoc (clef_glyph_, p); + found = scm_assoc (glyph, p); if (found == SCM_BOOL_F) return false; - c0_position_i_ = clef_position_i_ + gh_scm2int (gh_cdr (found)); + int c0_position = gh_scm2int (pos) + gh_scm2int (gh_cdr (found)); + daddy_trans_l_->set_property ("c0-position", gh_int2scm (c0_position)); } - c0_position_i_ -= (int) octave_dir_ * 7; + int c0_position = gh_scm2int (get_property ("c0-position")); + c0_position -= (int)octave_dir_ * 7; + daddy_trans_l_->set_property ("c0-position", gh_int2scm (c0_position)); + SCM basic = ly_symbol2scm ("Clef"); SCM c0 = ly_symbol2scm ("c0-position"); SCM gl = ly_symbol2scm ("glyph"); + daddy_trans_l_->execute_single_pushpop_property (basic, gl, SCM_UNDEFINED); daddy_trans_l_->execute_single_pushpop_property (basic, c0, SCM_UNDEFINED); - daddy_trans_l_->execute_single_pushpop_property (basic, gl, clef_glyph_); - daddy_trans_l_->execute_single_pushpop_property (basic, c0, gh_int2scm (c0_position_i_)); - + daddy_trans_l_->execute_single_pushpop_property (basic, gl, + get_property ("glyph")); + daddy_trans_l_->execute_single_pushpop_property (basic, c0, + get_property ("c0_position") + ); return true; } @@ -127,26 +130,31 @@ Clef_engraver::acknowledge_element (Score_element_info info) if (item) { if (Bar::has_interface (info.elem_l_) - && gh_string_p (clef_glyph_)) - create_clef(); + && gh_string_p (get_property ("glyph"))) + create_clef (); if (Note_head::has_interface (item) || Local_key_item::has_interface (item)) { - int p = int (Staff_symbol_referencer::position_f (item)) + c0_position_i_; - Staff_symbol_referencer::set_position (item,p); + int p = int (Staff_symbol_referencer::position_f (item)) + + gh_scm2int (get_property ("c0-position")); + Staff_symbol_referencer::set_position (item, p); } else if (Key_item::has_interface (item)) { - item->set_elt_property ("c0-position", gh_int2scm (c0_position_i_)); + item->set_elt_property ("c0-position", get_property ("c0-position")); } } } void -Clef_engraver::do_creation_processing() +Clef_engraver::do_creation_processing () { + daddy_trans_l_->set_property ("position", gh_int2scm (0)); + daddy_trans_l_->set_property ("glyph", SCM_EOL); + daddy_trans_l_->set_property ("c0-position", gh_int2scm (0)); + SCM def = get_property ("defaultClef"); if (gh_string_p (def)) { @@ -165,13 +173,11 @@ Clef_engraver::do_try_music (Music * r_l) return true; } - else - return false; - + return false; } void -Clef_engraver::create_clef() +Clef_engraver::create_clef () { if (!clef_p_) { @@ -182,7 +188,9 @@ Clef_engraver::create_clef() clef_p_ = c; } - Staff_symbol_referencer::set_position(clef_p_, clef_position_i_); + Staff_symbol_referencer::set_position (clef_p_, + gh_scm2int (get_property ("position") + )); if (octave_dir_) { Item * g = new Item (get_property ("OctavateEight")); @@ -198,40 +206,39 @@ Clef_engraver::create_clef() } } - void -Clef_engraver::do_process_music() +Clef_engraver::do_process_music () { if (clef_req_l_ || first_b_) { - create_clef(); + create_clef (); clef_p_->set_elt_property ("non-default", SCM_BOOL_T); } } void -Clef_engraver::do_pre_move_processing() +Clef_engraver::do_pre_move_processing () { if (clef_p_) { SCM vis = 0; - if(to_boolean (clef_p_->get_elt_property("non-default"))) + if (to_boolean (clef_p_->get_elt_property ("non-default"))) { vis = get_property ("explicitClefVisibility"); } if (vis) { - clef_p_->set_elt_property("visibility-lambda", vis); + clef_p_->set_elt_property ("visibility-lambda", vis); if (octavate_p_) - octavate_p_->set_elt_property("visibility-lambda", vis); + octavate_p_->set_elt_property ("visibility-lambda", vis); } typeset_element (clef_p_); clef_p_ =0; if (octavate_p_) - typeset_element(octavate_p_); + typeset_element (octavate_p_); octavate_p_ = 0; } @@ -240,10 +247,10 @@ Clef_engraver::do_pre_move_processing() } void -Clef_engraver::do_post_move_processing() +Clef_engraver::do_post_move_processing () { clef_req_l_ = 0; } -ADD_THIS_TRANSLATOR(Clef_engraver); +ADD_THIS_TRANSLATOR (Clef_engraver); diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 9d08d8bbb4..7f628c3c4b 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -61,7 +61,9 @@ Span_arpeggio_engraver::process_acknowledged () { span_arpeggio_ = new Item (get_property ("SpanArpeggio")); span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS); - // Side_position::set_axis (span_arpeggio_, X_AXIS); + Side_position::set_axis (span_arpeggio_, X_AXIS); + Side_position::set_direction (span_arpeggio_, LEFT); + Staff_symbol_referencer::set_interface (span_arpeggio_); Pointer_group_interface pgi (span_arpeggio_, "arpeggios"); for (int i = 0; i < arpeggios_.size () ; i++) { diff --git a/lily/span-arpeggio.cc b/lily/span-arpeggio.cc index cb5768da58..d55c4848c7 100644 --- a/lily/span-arpeggio.cc +++ b/lily/span-arpeggio.cc @@ -6,6 +6,8 @@ (c) 2000 Jan Nieuwenhuizen */ +#include + #include "axis-group-interface.hh" #include "molecule.hh" #include "paper-def.hh" @@ -57,9 +59,14 @@ Span_arpeggio::brew_molecule (SCM smob) a.translate_axis (i * staff_space, Y_AXIS); mol.add_molecule (a); } - // huh? - Real dy = me->relative_coordinate (common, Y_AXIS); - mol.translate (Offset (-2 * staff_space, -2*dy)); + /* + urg? + */ + Real dy = -(int)me->relative_coordinate (common, Y_AXIS); + dy += iv.length () / 2; + dy /= staff_space; + dy = staff_space * rint (dy); + mol.translate (Offset (0, dy)); return mol.create_scheme (); } diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index 11653a86c3..911aadeb0b 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -138,6 +138,7 @@ Text_spanner_engraver::typeset_all () { if (finished_) { + Side_position::add_staff_support (finished_); typeset_element (finished_); finished_ = 0; } diff --git a/ps/lily.ps b/ps/lily.ps index 85a6c08c76..65b0c0a04f 100644 --- a/ps/lily.ps +++ b/ps/lily.ps @@ -118,6 +118,17 @@ } bind def % /draw_dashed_line % dash thickness dx dy +{ + 1 setlinecap + 1 setlinejoin + setdash + setlinewidth + 0 0 moveto + lineto + stroke +} bind def +% +/xdraw_dashed_line % dash thickness dx dy { 1 setlinecap 1 setlinejoin -- 2.39.5