]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.95.jcn4
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 12 Oct 2000 21:00:18 +0000 (23:00 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 12 Oct 2000 21:00:18 +0000 (23:00 +0200)
1.3.95.jcn4
===========

* Clef-engraver: changed c0-position, clef-position and glyph into properties,
  enabling ottava spanners: input/test/ottava.ly.

12 files changed:
CHANGES
VERSION
input/les-nereides.ly
input/test/ottava.ly [new file with mode: 0644]
input/test/text-spanner.ly
lily/arpeggio-engraver.cc
lily/arpeggio.cc
lily/clef-engraver.cc
lily/span-arpeggio-engraver.cc
lily/span-arpeggio.cc
lily/text-spanner-engraver.cc
ps/lily.ps

diff --git a/CHANGES b/CHANGES
index b3be90fe669e47ec5bfee019e04ee4633c917b75..acde60e03b3967d81c9287300d7572eafe741901 100644 (file)
--- 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 32cd43fb7ae3e35df53ad979e10bf6a1aec1a235..9df76a8503710777b41c68216503304da8b70aa8 100644 (file)
--- 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.
index 29a797ac7fde51f61b1ae447555ed35d922f17af..79a08e0f8e3e7c25023e213a5b7a512feedb2c36 100644 (file)
@@ -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 (file)
index 0000000..e51a4c3
--- /dev/null
@@ -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"
+    }
+}
index 7746b7c3ba107edad4e963fd4d9576fd6f16b336..998e9d08513461c9d401ed348796afd1cf71724e 100644 (file)
        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
     }
 }
index 3c9504512ef84492d0eaf3c33329ba0b9954b379..f9a2ee65bb30963457781189592e69ce5147d41e 100644 (file)
@@ -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_);
     }
index 1e7253645c8a85e39fd60615222ae13610a79c72..b974768b0e34307c660391f356f790fad30e39d4 100644 (file)
@@ -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 (); 
 }
index 854456200698872a7a5b179b9d5db21bdf53dc6d..97cbe2049284ef8266e9fff649c9556789e9028e 100644 (file)
 /// 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);
 
index 9d08d8bbb4d1bdea94d4d2290671c0e3c399b4ed..7f628c3c4bf54eddea0da327bf2f749cd340995b 100644 (file)
@@ -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++)
        {
index cb5768da58df6011918ff308c7df7b4bdd5e0ab9..d55c4848c70b23c6262fd815247903295d10042f 100644 (file)
@@ -6,6 +6,8 @@
   (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
+#include <math.h>
+
 #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 (); 
 }
index 11653a86c3ec3ca3ea86c21e005588f086ef0136..911aadeb0b982dae2596a51059fb38769cd204d0 100644 (file)
@@ -138,6 +138,7 @@ Text_spanner_engraver::typeset_all ()
 {  
   if (finished_)
     {
+      Side_position::add_staff_support (finished_);
       typeset_element (finished_);
       finished_ = 0;
     }
index 85a6c08c76617e166517eef6e6d69539de0c0fd3..65b0c0a04f0209f10790290e9acc00e696b9e66c 100644 (file)
 } 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