]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.50
authorfred <fred>
Tue, 26 Mar 2002 23:21:46 +0000 (23:21 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:21:46 +0000 (23:21 +0000)
38 files changed:
Documentation/faq.texi
Documentation/user/properties.itely
ROADMAP
config.hh.in
flower/include/dictionary.hh
flower/include/hash-table.hh
flower/include/tuple.hh
input/bugs/slur.ly [new file with mode: 0644]
input/test/pedal.ly
input/test/tuplet.ly
lily/beam.cc
lily/bezier.cc
lily/breathing-sign.cc
lily/chord-name.cc
lily/clef-item.cc
lily/collision-engraver.cc
lily/collision.cc
lily/include/collision.hh
lily/include/ly-smobs.icc
lily/include/score-element-callback.hh [new file with mode: 0644]
lily/include/score-element.hh
lily/include/sustain-pedal.hh [new file with mode: 0644]
lily/note-column.cc
lily/piano-pedal-engraver.cc
lily/piano-pedal-performer.cc
lily/property-engraver.cc
lily/repeated-music.cc
lily/score-element-callback.cc [new file with mode: 0644]
lily/score-element.cc
lily/single-malt-grouping-item.cc
lily/slur.cc
lily/span-bar-engraver.cc
lily/sustain-pedal.cc [new file with mode: 0644]
lily/text-engraver.cc
lily/translator-ctors.cc
scm/generic-property.scm
scm/lily.scm
scripts/mudela-book.py

index 5934078e7f8ee6317bc3e50573451548ba0ca699..64232c2ae0d210e0f17f54f389208dc2de9a2630 100644 (file)
@@ -313,12 +313,12 @@ tagline="Typeset by GNU LilyPond"
 Theoretically, yes but it is easier to do with TeX:
 
 @example
-\def\foo{\hbox{\vrule width 15.0cm height 0.5pt depth 0.0pt}
+\def\foo@{\hbox@{\vrule width 15.0cm height 0.5pt depth 0.0pt@}
 \nointerlineskip
-\vskip 5pt\nointerlineskip}
-\def\musicline{\vbox {
+\vskip 5pt\nointerlineskip@}
+\def\musicline@{\vbox @{
      \foo\foo\foo\foo\foo
-}\par}
+@}\par@}
 
 \musicline
 \musicline
index 52af602fee4029054a7132329043c9d3db525d10..4bb6362dfd4dba74622731cdee1be9fe935a1108 100644 (file)
@@ -368,7 +368,7 @@ number respectively. Setting it to false will prevent printing of the
 associated element. Setting the property to 'if-no-beam will make it
 print only if there is no beam associated with this tuplet bracket.
 
-[fixme examples]
+@mudelafile[verbatim]{tuplet.ly}
 
   @item @code{tupletInvisible}@indexcode{tupletInvisible} @propertytype{boolean}
 
diff --git a/ROADMAP b/ROADMAP
index 3894dd5d9eca15eed05961101322763487782b47..dfe496a678e4f4121b6d046e1215bc752b282b49 100644 (file)
--- a/ROADMAP
+++ b/ROADMAP
@@ -31,9 +31,6 @@ LilyPond's source files.
      F.Schubert/
      Hymns/
      J.S.Bach/
-     L.Mozart/
-     N.W.Gade/
-     W.A.Mozart/
    intl/                       library for gettext
    po/                         translations
    ps/                         postscript library files
index 65772eaae94d6669c176eb4d5af061a013292243..833c0eec00263f59c307176068da3c0a3ad76042 100644 (file)
@@ -24,9 +24,6 @@
 /* define if you have isinf */
 #define HAVE_ISINF 0
 
-/* define if you have isinf */
-#define HAVE_ISINF 0
-
 /* define if explicit instantiation is needed */
 #undef NEED_EXPLICIT_INSTANTIATION
 
index 3cb1069b39e66c62df2f1ac553ed6bbac093ab6f..9134b80afcb5c1283e847b00a5f89d44f80270fb 100644 (file)
@@ -27,6 +27,9 @@ struct Dict_initialiser
 };
 
 
+/*
+  DEPRECATED. Use either SCM (preferred) or STL 
+ */
 template<class V>
 class Dictionary : public Hash_table<String, V>
 {
index bd437e6e972d7215f9546fcce539d789cbd809b0..f3f5bfe23402768e46f5206593b24abc5fd186d3 100644 (file)
@@ -43,7 +43,9 @@ struct Hash_table_entry
    A hash table of prime size.
 
    We use quadratic probing.  
- */
+
+  DEPRECATED. Use either SCM (preferred) or STL 
+*/
 template<class K, class V>
 class Fixed_size_hash_table
 {
index 251eca1afd2dc36ba6c2b387818e24b108607cb7..1adf194f1a90377a6ab4070963c13b089e200dd0 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef TUPLET_HH
 #define TUPLET_HH
+#error
 
 
 template<class T, class U>
diff --git a/input/bugs/slur.ly b/input/bugs/slur.ly
new file mode 100644 (file)
index 0000000..c2a8552
--- /dev/null
@@ -0,0 +1,5 @@
+
+ \score {
+       \notes \relative c' {
+       c2(  c  \break c c  c  c  \break c 
+}}
index 40410a32f6e12364bc1c9f4d3df4c5fd314c74de..a30ab93a09f95894e0e3d8716092494ca3e1280a 100644 (file)
@@ -1,7 +1,7 @@
 \score{
 \context Staff \notes\relative c'{
-c\sustaindown d e f\sustainup g\sustaindown b c
-c,\sustainup\sustaindown d e f \sustainup g\sustaindown b c
+c4\sustaindown d e f\sustainup g\sustaindown b c
+c, [d16 \sustainup \sustaindown c  c c] [e e \sustainup \sustaindown e e ] f4 \sustainup g\sustaindown b c
 \property Staff.stopStartSustain = #"-P"
 \property Staff.startSustain = #"P"
 c,\sustainup\sustaindown d e f \sustainup g\sustaindown b c
index 68e2768fd3b66a99bd7a8df0c431e660e3702b1d..d39c302143905d3e36f3164aa5743ae6c45a8621 100644 (file)
@@ -1,50 +1,15 @@
+\version "1.3.47"
+
 \score { 
-  \context Voice \notes\relative c {
-    \property Voice.textEmptyDimension = 1
-       \property Voice.textScriptPadding = 10
-       \property Voice.tupletVisibility = 0
-       \times2/3{c'4^"tupletVisibility = 0" d e} \times2/3{[f8 g a]} 
-         \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 1
-       \times2/3{c,4^"tupletVisibility = 1" d e} \times2/3{[f8 g a]} 
-         \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 2
-       \times2/3{c,4^"tupletVisibility = 2" d e} \times2/3{[f8 g a]} 
-         \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 3
-       \times2/3{c,4^"tupletVisibility = 3" d e} \times2/3{[f8 g a]} 
-         \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 4
-       \times2/3{c,4^"tupletVisibility = 4" d e} \times2/3{[f8 g a]} 
-         \times2/3{b16 c d} c8 | \break
-       
-       \property Voice.tupletDirection = \down
-       \property Voice.tupletVisibility = 0
-       \times2/3{c,4^"tupletDirection = down" d e} 
-         \times2/3{[[f8 g a]]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 1
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 2
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 3
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 4
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |\break
-       
-       \property Voice.tupletDirection = \up
-       \property Voice.tupletVisibility = 0
-       \times2/3{c,4^"tupletDirection = up" d e} 
-         \times2/3{[[f8 g a]]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 1
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 2
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 3
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       \property Voice.tupletVisibility = 4
-       \times2/3{c,4 d e} \times2/3{[f8 g a]} \times2/3{b16 c d} c8 |
-       
-  }
-  \paper { }  
-  \midi { }
-}
\ No newline at end of file
+  \context Voice \notes\relative c'' {
+
+  \times 2/3 { [c8 c c]  }
+  \times 2/3 { c8 [c c]  }
+
+  \property Voice .tupletBracketVisibility = #'if-no-beam  
+  \times 2/3 { [c8 c c]  }
+  \property Voice .tupletDirection = #1
+  \property Voice .tupletNumberVisibility = ##f
+  \times 2/3 { c8 [c c]  }
+}
+}
index 027a08d70f0499b37ee6b50296c2fe31d8260470..e19a82270b5e79b6a323d3e826d11cd0af0fc201 100644 (file)
     * less hairy code
     * move paper vars to scm
 
-
     remove *-hs variables.
-    
 */
 
 
-#include <math.h>              // tanh.
+#include <math.h> // tanh.
 #include "directional-element-interface.hh"
 #include "beaming.hh"
 #include "dimensions.hh"
index 0ced85b84069fbd472c1e933b6e17ae7dede373a..72bd0e0f46aafbb9790437fdab209858fd71544a 100644 (file)
@@ -31,8 +31,6 @@ binomial_coefficient (Real over , int under)
 void
 flip (Array<Offset>* arr_p, Axis a)
 {
-  // huh?
-  //  for (int i = c.size (); i--;)
   for (int i = 0; i < arr_p->size (); i++)
     (*arr_p)[i][a] = - (*arr_p)[i][a];
 }
index 2c1f5152491c973f261c2823915eebed4e5502df..64e588f727149c9c427d58f1040349fedd001ea7 100644 (file)
@@ -8,9 +8,9 @@
   TODO: --> see breathing-sign-engraver.cc
 
 */
+
 #include "staff-symbol-referencer.hh"
 #include "directional-element-interface.hh"
-
 #include "breathing-sign.hh"
 #include "string.hh"
 #include "molecule.hh"
@@ -32,6 +32,8 @@ Breathing_sign::do_brew_molecule () const
   Staff_symbol_referencer_interface si (this);
   
   Real space = si.staff_space();
+
+  // todo: cfg'able.
   Interval i1(0, space / 6), i2(-space / 2, space / 2);
   Box b(i1, i2);
 
index bb6fbbc1ea915bfa8620d030fc7d8b6ad4b6e938..7a05a08844b7eec3958193e9a7ba8ea44a08bc27 100644 (file)
    "text"
    ("style" . "text")
  */
+
+/*
+  UGH. remove Dictionary< > and use Scheme_hash_table
+ */
 Molecule
 Chord_name::ly_word2molecule (SCM word) const
 {
-  Dictionary<SCM> option_dict;
+  Dictionary<SCM> option_dict; // junkme
   if (gh_pair_p (word))
     {
       SCM options = gh_cdr (word);
index f0a8b8566f9d8175ae8bd1b423f2a4798ca33873..21d97d80754d74e0a6d733e219f447ce4ce94e16 100644 (file)
 #include "clef-item.hh"
 #include "string.hh"
 #include "molecule.hh"
-#include "paper-def.hh"
-#include "lookup.hh"
 #include "text-item.hh"
-#include "paper-score.hh"
-#include "dimension-cache.hh"
-#include "side-position-interface.hh"
-#include "warn.hh"
-#include "line-of-score.hh"
 
 void
 Clef_item::before_line_breaking ()
index 16d0bf30eae44a5f91955d715d662336b5783e05..eebb06122b2d2635ad313209ff9ccf5e869d1196 100644 (file)
@@ -7,16 +7,29 @@
 */
 
 #include "note-column.hh"
-#include "collision-engraver.hh"
 #include "collision.hh"
 #include "dimension-cache.hh"
+#include "engraver.hh"
+
+class Collision_engraver : public Engraver {
+  Collision* col_p_;
+  Link_array<Note_column> note_column_l_arr_;
+
+protected:
+  virtual void acknowledge_element (Score_element_info);
+  virtual void process_acknowledged ();
+  virtual void do_pre_move_processing();
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  Collision_engraver();
+};
+
 
 void
 Collision_engraver::process_acknowledged ()
 {
-   
   if (col_p_ || note_column_l_arr_.size () < 2)
-      return ;
+    return ;
   if (!col_p_) 
     {
       col_p_ = new Collision;
index c25f45d05c728d8ed5c2f24dc261af92defe695b..32ee0d69f685e985e038cfd6fde8e51ba3f30d39 100644 (file)
@@ -26,28 +26,29 @@ Collision::add_column (Note_column* ncol_l)
   add_dependency (ncol_l);
 }
 
-/*
-  UGH.  junk Shift_tup .
- */
-
 void
 Collision::before_line_breaking ()
 {
-  Array<Shift_tup> autos (automatic_shift ());
-  Array<Shift_tup> hand (forced_shift ());
+  SCM autos (automatic_shift ());
+  SCM hand (forced_shift ());
   Link_array<Score_element> done;
   
   Real wid = paper_l ()->get_var ("collision_note_width");
-  for (int i=0; i < hand.size (); i++)
+  for (; gh_pair_p (hand); hand =gh_cdr (hand))
     {
-      hand[i].e1_->translate_axis (hand[i].e2_ *wid, X_AXIS);
-      done.push (hand[i].e1_);
+      Score_element * s = unsmob_element (gh_caar (hand));
+      Real amount = gh_scm2double (gh_cdar (hand));
+      
+      s->translate_axis (amount *wid, X_AXIS);
+      done.push (s);
     }
-
-  for (int i=0; i < autos.size (); i++)
+  for (; gh_pair_p (autos); autos =gh_cdr (autos))
     {
-      if (!done.find_l (autos[i].e1_))
-       autos[i].e1_->translate_axis (autos[i].e2_ * wid, X_AXIS);
+      Score_element * s = unsmob_element (gh_caar (autos));
+      Real amount = gh_scm2double (gh_cdar (autos));
+      
+      if (!done.find_l (s))
+       s->translate_axis (amount * wid, X_AXIS);
     }
 }
 
@@ -57,13 +58,12 @@ Collision::before_line_breaking ()
   This should be done better, probably.
 
   */
-Array< Shift_tup >
+SCM
 Collision::automatic_shift ()
 {
   Drul_array<Link_array<Note_column> > clash_groups;
   Drul_array<Array<int> > shifts;
-  Array<Shift_tup>  tups;
-
+  SCM  tups = SCM_EOL;
 
   SCM s = get_elt_property ("elements");
   for (; gh_pair_p (s); s = gh_cdr (s))
@@ -151,8 +151,8 @@ Collision::automatic_shift ()
       Note_head * nu_l= cu_l->first_head();
       Note_head * nd_l = cd_l->first_head();
       
-      int downpos =    cd_l->head_positions_interval ()[BIGGER];
-      int uppos =      cu_l->head_positions_interval ()[SMALLER];      
+      int downpos = cd_l->head_positions_interval ()[BIGGER];
+      int uppos = cu_l->head_positions_interval ()[SMALLER];      
       
       bool merge  =
        downpos == uppos
@@ -179,17 +179,18 @@ Collision::automatic_shift ()
   do
     {
       for (int i=0; i < clash_groups[d].size (); i++)
-       tups.push (Shift_tup (clash_groups[d][i], offsets[d][i]));
+       tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm_, gh_double2scm (offsets[d][i])),
+                                tups);
     }
   while (flip (&d) != UP);
   return tups;
 }
 
 
-Array <Shift_tup>
+SCM
 Collision::forced_shift ()
 {
-  Array<Shift_tup> tups;
+  SCM tups = SCM_EOL;
   
   SCM s = get_elt_property ("elements");
   for (; gh_pair_p (s); s = gh_cdr (s))
@@ -199,7 +200,8 @@ Collision::forced_shift ()
       SCM force =  se->remove_elt_property ("force-hshift");
       if (gh_number_p (force))
        {
-         tups. push (Shift_tup (se, gh_scm2double (force)));
+         tups = gh_cons (gh_cons (se->self_scm_, force),
+                         tups);
        }
     }
   return tups;
index 64052db5e013f9415145a2ae5b5e0d0d47f6d11c..7a7b5379f2a74d9b59ba4cafdbbe20747c966e99 100644 (file)
 #define COLLISION_HH
 #include "lily-proto.hh"
 #include "item.hh"
-#include "tuple.hh"
 
-//junkme, use SCM conses.
-typedef Tuple<Score_element*, Real> Shift_tup;
 
 /**
   Resolve conflicts between various Note_columns (chords).
@@ -27,8 +24,8 @@ typedef Tuple<Score_element*, Real> Shift_tup;
 class Collision : public Item
 {
 protected:
-  Array<Shift_tup> automatic_shift ();
-  Array<Shift_tup> forced_shift ();
+  SCM automatic_shift ();
+  SCM forced_shift ();
   
   virtual void before_line_breaking ();
 public:
index 9b54ddc24e5e23165a83c5a11cad3aa251ed40b3..b652432ca8f3eeb89b928def2e03dd0fee35bfdb 100644 (file)
@@ -31,7 +31,9 @@ return s;\
 }\
 
 
-
+/*
+  should include equal_p ? 
+ */
 #define IMPLEMENT_SMOBS(CL)\
 long CL::smob_tag_;\
 static scm_smobfuns CL ## _funs = {                                    \
diff --git a/lily/include/score-element-callback.hh b/lily/include/score-element-callback.hh
new file mode 100644 (file)
index 0000000..949ceec
--- /dev/null
@@ -0,0 +1,21 @@
+/*   
+  score-element-callback.hh -- declare  Score_element callbacks
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef SCORE_ELEMENT_CALLBACK_HH
+#define SCORE_ELEMENT_CALLBACK_HH
+
+#include "lily-proto.hh"
+#include "lily-guile.hh"
+
+typedef SCM (* Score_element_callback) (Score_element * ,  SCM extra_params);
+SCM smobify_callback (Score_element_callback cb);
+
+
+#endif /* SCORE_ELEMENT_CALLBACK_HH */
+
index 768152545e7e6fb88dbfc43c7db7fc1a86e1772f..8bc4761cf16c1d9ee3642bdc4371f9373152a0a0 100644 (file)
@@ -140,6 +140,7 @@ public:
    */
   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
 
+
   static SCM handle_broken_smobs (SCM, SCM criterion);
   void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
 
@@ -199,11 +200,7 @@ public:
   bool used_b_;
   
   char const * name () const;
-  /**
-     Set empty in direction A.
-     JUNKME
-   */
-  void set_empty (Axis a);
+
   bool empty_b (Axis a) const;
   Interval extent (Axis) const;
  
diff --git a/lily/include/sustain-pedal.hh b/lily/include/sustain-pedal.hh
new file mode 100644 (file)
index 0000000..b2ae20e
--- /dev/null
@@ -0,0 +1,43 @@
+/*   
+  sustain-pedal.hh -- declare 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef SUSTAIN_PEDAL_HH
+#define SUSTAIN_PEDAL_HH
+
+#include "item.hh" 
+
+
+/*
+  Urg.
+  This is almost text
+  Problem is:
+    * we have no kerning
+    * symbols are at wrong place in font
+
+
+
+  Properties:
+
+  glyph -- text string (TODO:   make one large glyph of the Ped symbol, removes need for do_brew_molecule ())
+
+*/
+
+class Sustain_pedal : public Item
+{
+public:
+  VIRTUAL_COPY_CONS (Score_element);
+
+protected:
+  virtual Molecule do_brew_molecule () const;
+  virtual void after_line_breaking ();
+};
+
+
+#endif /* SUSTAIN_PEDAL_HH */
+
index 909629921cf1781571166e685764e92c8d7543c0..1f424860feaaaab8a140d1625bd20a6a43f45549 100644 (file)
@@ -44,6 +44,7 @@ Note_column::Note_column()
   set_elt_property ("note-heads", SCM_EOL);  
   Axis_group_interface (this).set_interface ();
   Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
+  Group_interface (this, "interfaces").add_thing (ly_symbol2scm ("Note_column"));
 }
 
 Stem *
index 61d00a4e9601953bb21a3402d81585c6d8983ebb..be57de3d8b305ec79ac2c2f8336ff1e4ac46f5bd 100644 (file)
 #include "stem.hh"
 #include "side-position-interface.hh"
 #include "staff-symbol-referencer.hh"
-#include "dictionary.hh"
-#include "dictionary-iter.hh"
 #include "text-item.hh"
-
-/*
-  Urg.
-  This is almost text
-  Problem is:
-    * we have no kerning
-    * symbols are at wrong place in font
-*/
-
-class Sustain_pedal : public Item
-{
-public:
-  VIRTUAL_COPY_CONS (Score_element);
-
-protected:
-  virtual Molecule do_brew_molecule () const;
-  virtual void after_line_breaking ();
-};
-
-void
-Sustain_pedal::after_line_breaking ()
-{
-  Side_position_interface i (this);
-  Direction d =  i.get_direction ();
-  i.set_direction (d);
-}
-
-Molecule
-Sustain_pedal::do_brew_molecule () const
-{
-  Molecule mol;
-  SCM glyph = get_elt_property ("glyph");
-  if (glyph == SCM_UNDEFINED)
-    return mol;
-  String text = ly_scm2string (glyph);
-
-  for (int i = 0; i < text.length_i (); i++)
-    {
-      // leuke koor dump door tiepo, snapnie helemaal:
-      //String idx = ("pedal-") + text[i];
-      // urg, Byte* ??
-      // braak: waarom vindt String het zo moeilijk om
-      // String + char te doen?
-      //String idx = "pedal-" + String (&text.byte_C ()[i], 1);
-      String idx = String ("pedal-") + String (&text.byte_C ()[i], 1);
-      Molecule m = lookup_l ()->afm_find (idx);
-      if (m.empty_b ())
-       continue;
-      Real kern = 0;
-      if (i)
-       {
-         SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"),
-                                    ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()),
-                                    ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()),
-                                    SCM_UNDEFINED));
-         if (gh_number_p (s))
-           {
-             Staff_symbol_referencer_interface st (this);
-             Real staff_space = st.staff_space ();
-             kern = gh_scm2double (s) * staff_space;
-           }
-       }
-      mol.add_at_edge (X_AXIS, RIGHT, m, kern);
-    }
-    
-  return mol;
-}
-
-
+#include "sustain-pedal.hh"
 
 /*
    TODO:
-     * it would be real cool if an engraver could be initialised with a
+     * it would be really cool if an engraver could be initialised with a
        string, ie:
 
           Piano_pedal_engraver::"sostenuto"
           Piano_pedal_engraver::"sustain"
           Piano_pedal_engraver::"una-chorda"
+
  */
 
+/*
+  Would it? The semantics are unclear, and real benefits are muddy
+  too.  --hwn
+*/
+
+
+
 /**
-   engrave Piano pedals
+   engrave Piano pedals symbols.
  */
 class Piano_pedal_engraver : public Engraver
 {
-  struct Pedal_info
-  {
-    Span_req* start_req_l_;
-    Drul_array<Span_req*> req_l_drul_;
-    Item* item_p_;
-  };
-
 public:
   VIRTUAL_COPY_CONS (Translator);
   Piano_pedal_engraver ();
-
+  ~Piano_pedal_engraver ();
 protected:
+  virtual void do_creation_processing ();
   virtual bool do_try_music (Music*);
   virtual void do_process_music ();
   virtual void do_pre_move_processing ();
@@ -123,24 +55,49 @@ protected:
   virtual void acknowledge_element (Score_element_info);
 
 private:
-  Dictionary<Pedal_info> info_dict_;
+  struct Pedal_info
+  {
+    char const * name_;
+    Span_req* start_req_l_;
+    Drul_array<Span_req*> req_l_drul_;
+    Item* item_p_;
+  };
+
+
+  Pedal_info *info_list_;
 };
 
 ADD_THIS_TRANSLATOR (Piano_pedal_engraver);
 
 Piano_pedal_engraver::Piano_pedal_engraver ()
 {
-  (void)info_dict_["Sostenuto"];
-  (void)info_dict_["Sustain"];
-  (void)info_dict_["UnaChorda"];
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  info_list_ = 0;
+}
+void
+Piano_pedal_engraver::do_creation_processing()
+{
+  info_list_ = new Pedal_info[4];
+  Pedal_info *p = info_list_;
+
+
+  char * names [] = { "Sostenuto", "Sustain", "UnaChorda", 0  };
+  char **np = names ;
+  do
     {
-      Pedal_info& p = i.val_ref ();
-      p.item_p_ = 0;
-      p.req_l_drul_[START] = 0;
-      p.req_l_drul_[STOP] = 0;
-      p.start_req_l_ = 0;
+      p->name_ = *np;
+      p->item_p_ = 0;
+      p->req_l_drul_[START] = 0;
+      p->req_l_drul_[STOP] = 0;
+      p->start_req_l_ = 0;
+
+      p++;
     }
+  while (*(np ++));
+}
+
+Piano_pedal_engraver::~Piano_pedal_engraver()
+{
+  delete[] info_list_;
 }
 
 /*
@@ -150,22 +107,21 @@ Piano_pedal_engraver::Piano_pedal_engraver ()
 void
 Piano_pedal_engraver::acknowledge_element (Score_element_info info)
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  for (Pedal_info*p = info_list_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
-      if (p.item_p_)
+      if (p->item_p_)
        {
          if (Note_head* n = dynamic_cast<Note_head*> (info.elem_l_))
            {
-             Side_position_interface st (p.item_p_);
+             Side_position_interface st (p->item_p_);
              st.add_support (n);
              if (st.get_axis( ) == X_AXIS
-                 && !p.item_p_->parent_l (Y_AXIS))
-               p.item_p_->set_parent (n, Y_AXIS);
+                 && !p->item_p_->parent_l (Y_AXIS))
+               p->item_p_->set_parent (n, Y_AXIS);
            }
          if (Stem* s = dynamic_cast<Stem*> (info.elem_l_))
            {
-             Side_position_interface st (p.item_p_);
+             Side_position_interface st (p->item_p_);
              st.add_support (s);
            }
        }
@@ -175,14 +131,13 @@ Piano_pedal_engraver::acknowledge_element (Score_element_info info)
 bool
 Piano_pedal_engraver::do_try_music (Music *m)
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  if (Span_req * s = dynamic_cast<Span_req*>(m))
     {
-      Pedal_info& p = i.val_ref ();
-      if (Span_req * s = dynamic_cast<Span_req*>(m))
+      for (Pedal_info*p = info_list_; p->name_; p ++)
        {
-         if (s->span_type_str_ == i.key ())
+         if (s->span_type_str_ == p->name_)
            {
-             p.req_l_drul_[s->span_dir_] = s;
+             p->req_l_drul_[s->span_dir_] = s;
              return true;
            }
        }
@@ -193,70 +148,65 @@ Piano_pedal_engraver::do_try_music (Music *m)
 void
 Piano_pedal_engraver::do_process_music ()
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  for (Pedal_info*p = info_list_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
       SCM s = SCM_UNDEFINED;
-      if (p.req_l_drul_[STOP] && p.req_l_drul_[START])
+      if (p->req_l_drul_[STOP] && p->req_l_drul_[START])
        {
-         if (!p.start_req_l_)
+         if (!p->start_req_l_)
            {
-             p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ()));
+             p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s",  p->name_ ));
            }
          else
            {
-             s = get_property ("stopStart" + i.key ());
+             s = get_property ("stopStart" + String (p->name_ ));
            }
-         p.start_req_l_ = p.req_l_drul_[START];
+         p->start_req_l_ = p->req_l_drul_[START];
        }
-      else if (p.req_l_drul_[STOP])
+      else if (p->req_l_drul_[STOP])
        {
-         if (!p.start_req_l_)
+         if (!p->start_req_l_)
            {
-             p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ()));
+             p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", p->name_ ));
            }
          else
            {
-             s = get_property ("stop" + i.key ());
+             s = get_property ("stop" + String (p->name_ ));
            }
-         p.start_req_l_ = 0;
+         p->start_req_l_ = 0;
        }
-      else if (p.req_l_drul_[START])
+      else if (p->req_l_drul_[START])
        {
-         p.start_req_l_ = p.req_l_drul_[START];
-         s = get_property ("start" + i.key ());
+         p->start_req_l_ = p->req_l_drul_[START];
+         s = get_property ("start" + String (p->name_ ));
        }
 
       if (s != SCM_UNDEFINED)
        {
-         if (i.key () == "Sustain")
+         if (p->name_ == String ("Sustain"))
            {
-             p.item_p_ = new Sustain_pedal;
-             p.item_p_->set_elt_property ("glyph", s);
+             p->item_p_ = new Sustain_pedal;
+             p->item_p_->set_elt_property ("text", s);
            }
          else
            {
-             p.item_p_ = new Text_item;
-             p.item_p_->set_elt_property ("text", s);
+             p->item_p_ = new Text_item;
+             p->item_p_->set_elt_property ("text", s);
              // guh
-             p.item_p_->set_elt_property ("style", ly_str02scm ("italic"));
+             p->item_p_->set_elt_property ("style", ly_str02scm ("italic"));
            }
 
-         Side_position_interface si (p.item_p_);
+         Side_position_interface si (p->item_p_);
          si.set_axis (Y_AXIS);
 
-         /* Hmm,
-            If set to empty, it can't be centred
-            Howto centre non-fat text?
-            p.item_p_->set_empty (X_AXIS);
-         */
-         p.item_p_->set_elt_property ("self-alignment-X", gh_int2scm (0));
-         p.item_p_->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS);
-         p.item_p_->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS);
-         announce_element (Score_element_info (p.item_p_,
-                                               p.req_l_drul_[START]
-                                               ? p.req_l_drul_[START]
-                                               : p.req_l_drul_[STOP]));
+         p->item_p_->set_elt_property ("no-spacing-rods"  , SCM_BOOL_T);
+         p->item_p_->set_elt_property ("self-alignment-X", gh_int2scm (0));
+         p->item_p_->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS);
+         p->item_p_->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS);
+         announce_element (Score_element_info (p->item_p_,
+                                               p->req_l_drul_[START]
+                                               ? p->req_l_drul_[START]
+                                               : p->req_l_drul_[STOP]));
        }
     }
 }
@@ -264,36 +214,41 @@ Piano_pedal_engraver::do_process_music ()
 void
 Piano_pedal_engraver::do_pre_move_processing ()
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  Item * sustain = 0;
+  for (Pedal_info*p = info_list_; p->name_; p ++)
+    {
+      if (p->name_ == String ("Sustain"))
+       sustain = p->item_p_;
+    }
+
+  for (Pedal_info*p = info_list_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
-      if (p.item_p_)
+      if (p->item_p_)
        {
-         side_position (p.item_p_).add_staff_support ();
+         side_position (p->item_p_).add_staff_support ();
          /*
            Hmm.
          */
-         if (i.key () != "Sustain")
+         if (p->name_ != String ("Sustain"))
            {
-             if (Item* sustain = info_dict_["Sustain"].item_p_)
+             if (sustain)
                {
-                 Side_position_interface st (p.item_p_);
+                 Side_position_interface st (p->item_p_);
                  st.add_support (sustain);
                }
            }
-         typeset_element (p.item_p_);
+         typeset_element (p->item_p_);
        }
-      p.item_p_ = 0;
+      p->item_p_ = 0;
     }
 }
 
 void
 Piano_pedal_engraver::do_post_move_processing ()
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  for (Pedal_info*p = info_list_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
-      p.req_l_drul_[STOP] = 0;
-      p.req_l_drul_[START] = 0;
+      p->req_l_drul_[STOP] = 0;
+      p->req_l_drul_[START] = 0;
     }
 }
index 01dfab892ff7260916df6196c1002f2f2ef11b74..c3d2a1a0f4eb322a3a7271ff10e0fcfbb5607fb9 100644 (file)
@@ -20,16 +20,18 @@ class Piano_pedal_performer : public Performer
 {
   struct Pedal_info
   {
+    char const *name_;
     Span_req* start_req_l_;
     Drul_array<Span_req*> req_l_drul_;
   };
 
 public:
   VIRTUAL_COPY_CONS (Translator);
-  
   Piano_pedal_performer ();
-
+  ~Piano_pedal_performer ();
+  
 protected:
+  virtual void do_creation_processing ();
   virtual bool do_try_music (Music*);
   virtual void do_process_music ();
   virtual void do_pre_move_processing ();
@@ -37,52 +39,68 @@ protected:
 
 private:
   Link_array<Audio_piano_pedal> audio_p_arr_;
-  Dictionary<Pedal_info> info_dict_;
+  Pedal_info * info_alist_;
 };
 
 ADD_THIS_TRANSLATOR (Piano_pedal_performer);
 
 Piano_pedal_performer::Piano_pedal_performer ()
 {
-  (void)info_dict_["Sostenuto"];
-  (void)info_dict_["Sustain"];
-  (void)info_dict_["UnaChorda"];
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  info_alist_ = 0;
+}
+
+Piano_pedal_performer::~Piano_pedal_performer()
+{
+  delete[] info_alist_;
+}
+
+void
+Piano_pedal_performer::do_creation_processing ()
+{
+  info_alist_ = new Pedal_info[4];
+  Pedal_info *p = info_alist_;
+
+  char * names [] = { "Sostenuto", "Sustain", "UnaChorda", 0  };
+  char **np = names ;
+  do
     {
-      Pedal_info& p = i.val_ref ();
-      p.req_l_drul_[START] = 0;
-      p.req_l_drul_[STOP] = 0;
-      p.start_req_l_ = 0;
+      p->name_ = *np;
+      p->req_l_drul_[START] = 0;
+      p->req_l_drul_[STOP] = 0;
+      p->start_req_l_ = 0;
+
+      p++;
     }
+  while (*(np ++));
 }
 
 void
 Piano_pedal_performer::do_process_music ()
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  for (Pedal_info*p = info_alist_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
-      if (p.req_l_drul_[STOP])
+      if (p->req_l_drul_[STOP])
        {
-         if (!p.start_req_l_)
+         if (!p->start_req_l_)
            {
-             p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ()));
+             p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", String (p->name_)));
            }
          else
            {
              Audio_piano_pedal* a = new Audio_piano_pedal;
-             a->type_str_ = i.key ();
+             a->type_str_ = String (p->name_);
              a->dir_ = STOP;
              audio_p_arr_.push (a);
            }
-         p.start_req_l_ = 0;
+         p->start_req_l_ = 0;
        }
 
-      if (p.req_l_drul_[START])
+      if (p->req_l_drul_[START])
        {
-         p.start_req_l_ = p.req_l_drul_[START];
+         p->start_req_l_ = p->req_l_drul_[START];
          Audio_piano_pedal* a = new Audio_piano_pedal;
-         a->type_str_ = i.key ();
+         a->type_str_ = String (p->name_);
          a->dir_ = START;
          audio_p_arr_.push (a);
        }
@@ -92,7 +110,7 @@ Piano_pedal_performer::do_process_music ()
 void
 Piano_pedal_performer::do_pre_move_processing ()
 {
-  for (int i=0; i < audio_p_arr_.size (); i++)
+  for (int i=0; i< audio_p_arr_.size (); i++)
     play_element (audio_p_arr_[i]);
   audio_p_arr_.clear ();
 }
@@ -100,25 +118,23 @@ Piano_pedal_performer::do_pre_move_processing ()
 void
 Piano_pedal_performer::do_post_move_processing ()
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  for (Pedal_info*p = info_alist_; p->name_; p ++)
     {
-      Pedal_info& p = i.val_ref ();
-      p.req_l_drul_[STOP] = 0;
-      p.req_l_drul_[START] = 0;
+      p->req_l_drul_[STOP] = 0;
+      p->req_l_drul_[START] = 0;
     }
 }
 
 bool
 Piano_pedal_performer::do_try_music (Music* r)
 {
-  for (Dictionary_iter <Pedal_info> i (info_dict_); i.ok (); i++)
+  if (Span_req * s = dynamic_cast<Span_req*>(r))
     {
-      Pedal_info& p = i.val_ref ();
-      if (Span_req * s = dynamic_cast<Span_req*>(r))
+      for (Pedal_info*p = info_alist_; p->name_; p ++)
        {
-         if (s->span_type_str_ == i.key ())
+         if (s->span_type_str_ == String (p->name_))
            {
-             p.req_l_drul_[s->span_dir_] = s;
+             p->req_l_drul_[s->span_dir_] = s;
              return true;
            }
        }
index c0f2887008f22d93a14e5b5652cd9422f048e5be..b60416ef421ab853cc2ab1765ded1642530c2dfb 100644 (file)
 #include "protected-scm.hh"
 #include "dictionary.hh"
 #include "score-element.hh"
+#include "scm-hash.hh"
 
 class Property_engraver : public Engraver
 {
-  Dictionary<Protected_scm> prop_dict_;
+  /*
+    UGH. Junk Dictionary
+  */
+  Scheme_hash_table prop_dict_;        // junkme
   void apply_properties (SCM, Score_element*);
 
 protected:
@@ -29,24 +33,29 @@ void
 Property_engraver::do_creation_processing ()
 {
   SCM plist = get_property ("Generic_property_list");
-  for (; SCM_NIMP (plist); plist = gh_cdr (plist))
+  for (; gh_pair_p (plist); plist = gh_cdr (plist))
     {
       SCM elt_props = gh_car (plist);
-      prop_dict_[ly_scm2string (gh_car (elt_props))] = gh_cdr (elt_props);
+      prop_dict_.set (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_);
+  SCM ifs = i.elem_l_->get_elt_property ("interfaces");
+  SCM props;
+  for (; gh_pair_p (ifs); ifs = gh_cdr (ifs))
+    {      
+      if (prop_dict_.try_retrieve (gh_car (ifs), &props))
+       {
+         apply_properties (props,i.elem_l_);
+       }
     }
-  if (prop_dict_.elem_b ("all"))
+
+  if (prop_dict_.try_retrieve (ly_symbol2scm ("all"), &props))
     {
-      apply_properties (prop_dict_["all"], i.elem_l_);
+      apply_properties (props, i.elem_l_);
     }
 }
 
@@ -80,7 +89,8 @@ Property_engraver::apply_properties (SCM p, Score_element *e)
               == SCM_BOOL_T)   // defined and  right type: do it
        e->set_elt_property (ly_symbol2string (elt_prop_sym), val);
       else
- /*
+
+       /*
            we don't print a warning if VAL == #f, because we would
            get lots of warnings when we restore stuff to default, eg.
 
@@ -89,20 +99,20 @@ Property_engraver::apply_properties (SCM p, Score_element *e)
            should not cause "type error: slurDash expects number not
            boolean"
 
-         */
+       */
        if (val != SCM_BOOL_F)
-       {                       // not the right type: error message.
-         SCM errport = scm_current_error_port ();
-         warning (_("Wrong type for property"));
-         scm_display (prop_sym, errport);
-         scm_puts (", type predicate: ", errport);
-         scm_display (type_p, errport);
-         scm_puts (", value found: ", errport);
-         scm_display (val, errport);
-         scm_puts (" type: ", errport);
-         scm_display (ly_type (val), errport);
-         scm_puts ("\n", errport);
-       }
+         {                     // not the right type: error message.
+           SCM errport = scm_current_error_port ();
+           warning (_("Wrong type for property"));
+           scm_display (prop_sym, errport);
+           scm_puts (", type predicate: ", errport);
+           scm_display (type_p, errport);
+           scm_puts (", value found: ", errport);
+           scm_display (val, errport);
+           scm_puts (" type: ", errport);
+           scm_display (ly_type (val), errport);
+           scm_puts ("\n", errport);
+         }
     }
 }
 
index bf6b9908d52df87f932d62d000d0cf597846af94..acdccf98f102c3b3b4488b39f787ec5474034a81 100644 (file)
@@ -29,7 +29,7 @@ Repeated_music::Repeated_music (Repeated_music const &s)
   repeats_i_ = s.repeats_i_;
   fold_b_ = s.fold_b_;
   volta_fold_b_ = s.volta_fold_b_;
-  
+  type_ = s.type_;
   repeat_body_p_ = s.repeat_body_p_ ? s.repeat_body_p_->clone () : 0;
   alternatives_p_ = s.alternatives_p_
     ? dynamic_cast<Music_sequence*> (s.alternatives_p_->clone ()):0;
diff --git a/lily/score-element-callback.cc b/lily/score-element-callback.cc
new file mode 100644 (file)
index 0000000..9e81fe5
--- /dev/null
@@ -0,0 +1,58 @@
+/*   
+  score-element-callback.cc --  implement Callback smob.
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "score-element-callback.hh"
+
+
+static long callback_tag;
+
+static
+SCM mark_smob (SCM)
+{
+  return SCM_EOL;
+}
+
+static int
+print_smob (SCM, SCM port, scm_print_state *)
+{
+  scm_puts ("#<Callback>", port);
+  return 1;
+}
+
+static
+scm_sizet free_smob (SCM)
+{
+  return 0;
+}
+
+static scm_smobfuns callback_funs = {
+  mark_smob, free_smob,
+  print_smob, 0,
+};
+
+static
+void start_callback_smobs()
+{
+  callback_tag = scm_newsmob (&callback_funs);
+}
+
+
+SCM
+smobify_callback (Score_element_callback cb )
+{
+  SCM z;
+  
+  SCM_NEWCELL(z);
+  SCM_SETCDR(z, cb);
+  SCM_SETCAR(z, callback_tag);
+
+  return z;
+}
+  
+ADD_SCM_INIT_FUNC(callback, start_callback_smobs);
index c8307754ce4d79021aa0f7c3f27e1172f5631219..891f67e09272121f71a0fa2a24e484c82fe4bd0e 100644 (file)
@@ -209,24 +209,6 @@ Score_element::add_processing()
     return;
   status_i_ ++;
 
-#if 0
-    /*
-    UGH. UGH. UGH.
-   */
-  if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED
-      && !dim_cache_[X_AXIS]->off_callback_l_)
-    {
-      add_offset_callback (Side_position_interface::aligned_on_self,X_AXIS);
-    }
-  
-  if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED
-      && !dim_cache_[X_AXIS]->off_callback_l_)
-      
-    {
-      add_offset_callback (Side_position_interface::aligned_on_self, Y_AXIS);
-    }
-#endif
-  
   do_add_processing();
 }
 
index b03d4c59beb48e0061f8a80cf839bedff701dbdb..b017addc21d4f99f1fb77f77fa007817f65e9ab9 100644 (file)
@@ -55,6 +55,11 @@ Single_malt_grouping_item::my_width () const
          continue;             /*UGH UGH*/ 
        }
 
+      if (to_boolean (il->get_elt_property ("no-spacing-rods")))
+       {
+         continue;
+       }
+
       Interval iv (il->extent (X_AXIS));
       if (!iv.empty_b ())
        {
index 9b16216728c99ba1aef006bd1d54456c6de0c8fd..13b2c7b7c8e6e77736f6727bae02ebfd6e28984a 100644 (file)
@@ -223,14 +223,6 @@ Slur::Slur ()
 
   set_elt_property ("note-columns", SCM_EOL);
   set_elt_property ("control-points", SCM_EOL);
-
-#if 0
-  /*
-    I still don't understand the merits of this Group_interface.
-   */
-  Group_interface c (this, "control-points");
-  c.set_interface ();
-#endif
 }
 
 void
@@ -240,8 +232,7 @@ Slur::add_column (Note_column*n)
     warning (_ ("Putting slur over rest.  Ignoring."));
   else
     {
-      Group_interface gi (this, "note-columns");
-      gi.add_element (n);
+      Group_interface (this, "note-columns").add_element (n);
       add_dependency (n);
     }
 }
index 10d2c345a853de9d7f374b92fc8883ca15c117d8..6b9db20f74142704b2a4e07193a918dc28bdc475 100644 (file)
@@ -62,13 +62,9 @@ Span_bar_engraver::acknowledge_element (Score_element_info i)
          spanbar_p_->set_parent (bar_l_arr_[0], Y_AXIS);
          spanbar_p_->set_parent (bar_l_arr_[0], X_AXIS);
 
-         /*
-           UGH. UGH UUHGK GUHG G
-          */
-         String visnam =  String(name()) + "-visibility";
-
-         spanbar_p_->set_elt_property ("visibility-lambda",
-                                       scm_eval (ly_symbol2scm (visnam.ch_C())));
+         SCM v = bar_l_arr_[0]->get_elt_property ("visibility-lambda");
+         if (gh_procedure_p (v))
+           spanbar_p_->set_elt_property ("visibility-lambda",v);
 
          spanbar_p_->set_parent (bar_l_arr_[0], X_AXIS);
          announce_element (Score_element_info (spanbar_p_,0));
diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc
new file mode 100644 (file)
index 0000000..a6388d6
--- /dev/null
@@ -0,0 +1,62 @@
+/*   
+  sustain-pedal.cc --  implement Sustain_pedal
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "sustain-pedal.hh"
+#include "side-position-interface.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+#include "staff-symbol-referencer.hh"
+
+void
+Sustain_pedal::after_line_breaking ()
+{
+  /*
+    UGH. Should work automatically via offset callback. 
+   */
+  Side_position_interface i (this);
+  Direction d =  i.get_direction ();
+  i.set_direction (d);
+}
+
+Molecule
+Sustain_pedal::do_brew_molecule () const
+{
+  Molecule mol;
+  SCM glyph = get_elt_property ("text");
+  if (glyph == SCM_UNDEFINED)
+    return mol;
+  String text = ly_scm2string (glyph);
+
+  for (int i = 0; i < text.length_i (); i++)
+    {
+      String idx = String ("pedal-") + String (&text.byte_C ()[i], 1);
+      Molecule m = lookup_l ()->afm_find (idx);
+      if (m.empty_b ())
+       continue;
+      Real kern = 0;
+      if (i)
+       {
+         SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"),
+                                    ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()),
+                                    ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()),
+                                    SCM_UNDEFINED));
+         if (gh_number_p (s))
+           {
+             Staff_symbol_referencer_interface st (this);
+             Real staff_space = st.staff_space ();
+             kern = gh_scm2double (s) * staff_space;
+           }
+       }
+      mol.add_at_edge (X_AXIS, RIGHT, m, kern);
+    }
+    
+  return mol;
+}
+
+
index 0f222daab1bd2f1d6022c20729ed0fe437647a96..c0ab61393794be4c987a2c08876189004c0146f9 100644 (file)
@@ -104,8 +104,10 @@ Text_engraver::do_process_music ()
       
       SCM empty = get_property ("textNonEmpty");
       if (!to_boolean (empty))
-       text->set_extent_callback (0, X_AXIS);
-
+       {
+         text->set_elt_property ("no-spacing-rods" , SCM_BOOL_T);
+         text->set_extent_callback (0, X_AXIS);
+       }
       announce_element (Score_element_info (text, r));
       texts_.push (text);
     }
index acb9523cc04a75dbe9656057173ba8393808b0e2..8c72758890b4a9be4940736b3e10f799638a91ae 100644 (file)
@@ -15,6 +15,9 @@
   should delete these after exit.
  */
 
+/*
+  UGH. Dictionary is deprecated
+ */
 Dictionary<Translator*> *global_translator_dict_p=0;
 
 void
index 57ef8859ba40faaa66deba9e753b733bc648b2e4..ac38879b5545309e4f89eef4980cbfaf6e389dc8 100644 (file)
@@ -1,7 +1,7 @@
 
 ;
 ; Format: 
-; (cons "Type name"
+; (cons 'Type name
 ;    (list PROPERTYDESCRIPTIONS))
 ; 
 ; where
@@ -15,7 +15,7 @@
 
 
 (define generic-beam-properties
-  (cons "Beam"
+  (cons 'Beam
        (list
         (list 'beamSlopeDamping number? 'damping)
         (list 'autoKneeGap number? 'auto-knee-gap)
@@ -29,7 +29,7 @@
 
 
 (define generic-stem-properties
-  (cons "Stem"
+  (cons 'Stem
        (list
         (list 'stemVerticalDirection dir? 'direction)
         (list 'verticalDirection dir? 'direction)       
   )
 
 (define generic-dot-properties
-  (cons "Dots" (list
+  (cons 'Dots
+       (list
                (list 'dotDirection dir? 'direction)
                (list 'verticalDirection dir? 'direction)
                )
        ))
 
 (define generic-script-properties
-  (cons "Script" (list
+  (cons 'Script (list
                  (list 'articulationScriptVerticalDirection dir? 'direction)
                  (list 'articulationScriptPadding number? 'padding)
 
@@ -59,7 +60,7 @@
 
 
 (define generic-text-properties
-  (cons "Text_item" (list
+  (cons 'Text_item (list
                     (list 'textStyle string? 'style)
                     (list 'textScriptPadding number? 'padding)
                     (list 'textVerticalAlignment dir? 'self-alignment-Y)
        ))
 
 (define generic-sustain-pedal-properties
-  (cons "Sustain_pedal" (list
+  (cons 'Sustain_pedal (list
                         (list 'textScriptPadding number? 'padding)
                         (list 'sustainPedalPadding number? 'padding))))
 
 (define generic-chord-name-properties
-  (cons "Chord_name" (list
+  (cons 'Chord_name (list
                      (list 'textScriptWordSpace number? 'word-space)
                      (list 'chordNameWordSpace number? 'word-space)
                      (list 'chordNameStyle string? 'style))))
 
 (define generic-crescendo-properties
-  (cons "Crescendo" (list
+  (cons 'Crescendo (list
                     (list 'dynamicDirection dir? 'direction)
                     (list 'verticalDirection dir? 'direction)
                     (list 'dynamicPadding number? 'padding) 
@@ -88,7 +89,7 @@
                     )))
   
 (define generic-dynamic-line-spanner-properties
-  (cons "Dynamic_line_spanner" (list
+  (cons 'Dynamic_line_spanner (list
                     (list 'dynamicDirection dir? 'direction)
                     (list 'verticalDirection dir? 'direction)
                     (list 'dynamicPadding number? 'padding) 
                     )))
   
 (define generic-volta-spanner-properties
-  (cons "Volta_spanner" (list
+  (cons 'Volta_spanner (list
                     (list 'voltaVerticalDirection dir? 'direction)
                     (list 'voltaPadding number? 'padding) 
                     (list 'voltaMinimumSpace number? 'minimum-space) 
                     )))
   
 (define generic-bar-properties
-  (cons "Staff_bar" (list
+  (cons 'Staff_bar (list
                     (list 'barSize number? 'bar-size))
        )
   )    
 
 ; don't do this yet. Depends on whennn the staff is really announced
 (define generic-staff-symbol-properties
-  (cons "Staff_symbol" (list
+  (cons 'Staff_symbol (list
                        )
        )
   )
 
 (define generic-breathing-sign-properties
-  (cons "Breathing_sign"
+  (cons 'Breathing_sign
        (list
         (list 'breathingSignVerticalDirection dir? 'direction)
         (list 'verticalDirection dir? 'direction)
         )))
 
 (define generic-clef-properties
-  (cons "Clef_item"
+  (cons 'Clef_item
        (list
         (list 'clefStyle string? 'style))
        )
   )
 
 (define generic-All-properties
-  (cons "all"  (list (list 'fontSize number? 'fontsize))))
+  (cons 'all  (list (list 'fontSize number? 'fontsize))))
 
 
 (define generic-notehead-properties
-  (cons "Note_head" (list (list 'noteHeadStyle symbol? 'style))))
+  (cons 'Note_head
+       (list (list 'noteHeadStyle symbol? 'style))))
 
 
 (define generic-rest-properties
-  (cons "Rest" (list (list 'restStyle string? 'reststyle))))
+  (cons 'Rest
+       (list (list 'restStyle string? 'reststyle))))
 
 (define generic-rest-collision-properties
-  (cons "Rest_collision" (list (list 'maximumRestCount number? 'maximum-rest-count))))
+  (cons 'Rest_collision
+       (list (list 'maximumRestCount number? 'maximum-rest-count))))
 
 (define generic-tie-properties
-  (cons "Tie" (list
+  (cons 'Tie (list
               (list 'tieVerticalDirection dir? 'direction)
               (list 'verticalDirection dir? 'direction)
 (list 'tieDash number? 'dashed)
   )))
 
 (define generic-tie-column-properties
-  (cons "Tie_column" (list
+  (cons 'Tie_column (list
                      (list 'tieVerticalDirection dir? 'direction)
                      (list 'verticalDirection dir? 'direction)
   )))
 
 (define generic-note-column-properties
-  (cons "Note_column"
+  (cons 'Note_column
        (list
         (list 'horizontalNoteShift number? 'horizontal-shift)
         (list 'forceHorizontalShift number? 'force-hshift)
         )))
 
 (define generic-collision-properties
-  (cons "Collision"
+  (cons 'Collision
        (list
         (list 'collisionMergeDotted boolean? 'merge-differently-dotted)
         )
   )
   
 (define generic-slur-properties
-  (cons "Slur"
+  (cons 'Slur
        (list
         (list 'slurVerticalDirection dir? 'direction)
         (list 'verticalDirection dir? 'direction)       
         (list 'slurDash number? 'dashed))))
 
 (define generic-timesig-properties
-  (cons "Time_signature"
+  (cons 'Time_signature
        (list
         (list 'timeSignatureStyle string? 'style))))
 
   (or (boolean? s) (symbol? s)))
 
 (define generic-tuplet-spanner-properties
-  (cons "Tuplet_spanner"
+  (cons 'Tuplet_spanner
        (list
+        (list 'tupletDirection dir? 'direction)
         (list 'tupletNumberVisibility symbol-or-boolean? 'tuplet-number-visibility)
         (list 'tupletBracketVisibility symbol-or-boolean? 'tuplet-bracket-visibility)
        ))
index d2e5b83c01b3613a4d0fdc89a6cde5d3b3d2f7c8..fec2be9cfe43ce1edab9411f3f7657a275044fc8 100644 (file)
@@ -7,7 +7,7 @@
 
 ;
 ; This file contains various routines in Scheme that are easier to 
-; do here than in C++.  At present it is a unorganised mess. Sorry. 
+; do here than in C++.  At present it is an unorganised mess. Sorry. 
 ;
 
 
@@ -90,9 +90,6 @@
 (define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
 
 
-;; Score_span_bars are only visible at start of line
-;; i.e. if break_dir == RIGHT == 1
-(define Span_bar_engraver-visibility begin-of-line-invisible)
 (define mark-visibility end-of-line-invisible)
 
 ;; Spacing constants for prefatory matter.
 
 (define (scm-as-output)
   (eval (as-scm 'all-definitions)))
-                               
-; Russ McManus, <mcmanus@IDT.NET>  
-; 
-; I use the following, which should definitely be provided somewhere
-; in guile, but isn't, AFAIK:
-; 
-; 
-
-(define (hash-table-for-each fn ht)
-  (do ((i 0 (+ 1 i)))
-      ((= i (vector-length ht)))
-    (do ((alist (vector-ref ht i) (cdr alist)))
-       ((null? alist) #t)
-      (fn (car (car alist)) (cdr (car alist))))))
-
-(define (hash-table-map fn ht)
-  (do ((i 0 (+ 1 i))
-       (ret-ls '()))
-      ((= i (vector-length ht)) (reverse ret-ls))
-    (do ((alist (vector-ref ht i) (cdr alist)))
-       ((null? alist) #t)
-      (set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
-
-
-
+       
 (define (index-cell cell dir)
   (if (equal? dir 1)
       (cdr cell)
      )
    )
      
-
-(define (slur-ugly ind ht)
-  (if (and
-;       (< ht 4.0)
-       (< ht (* 4 ind))
-       (> ht (* 0.4 ind))
-       (> ht (+ (* 2 ind) -4))
-       (< ht (+ (* -2 ind) 8)))
-      #f
-      (cons ind  ht)
-  ))
index a78822588d18363d6fc2d86059fe87c2a109f197..ca4b70f8ad6e79ed95b27099478687a83dec57d9 100644 (file)
@@ -19,6 +19,13 @@ dep_prefix = ''
 
 # BUG: does not handle \verb|\begin{verbatim}\end{verbatim}| correctly.
 # Should make a joint RE for \verb and \begin, \end{verbatim}
+
+# TODO: add an option to read the .ly files from a previous run and dump
+# the .tex file, so you can do
+#
+# * mudela-book file.tex
+# * convert-mudela *.ly
+# * mudela-book --read-lys *.ly
 #
 
 default_music_fontsize = 16