]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.95.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 11 Oct 2000 21:02:08 +0000 (23:02 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 11 Oct 2000 21:02:08 +0000 (23:02 +0200)
1.3.95.jcn2
===========

* Dropped text support and padding of crescendo symbol.  Horizontal
  alignment of dynamics is handled by side-support, Text crescendos
  use the generic Text spanner.

CHANGES
VERSION
lily/crescendo.cc
lily/dynamic-engraver.cc
lily/include/crescendo.hh
lily/span-arpeggio.cc

diff --git a/CHANGES b/CHANGES
index b682e4aedfb8e8e3cb84b38e2f093b1d7680ac2f..d7b290a7a91ad284f02ff32db9b9f36017d83d63 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+1.3.95.jcn2
+===========
+
+* Dropped text support and padding of crescendo symbol.  Horizontal
+  alignment of dynamics is handled by side-support, Text crescendos
+  use the generic Text spanner.
+
 1.3.95.jcn1
 ===========
 
diff --git a/VERSION b/VERSION
index c38b2de43afd6336871be2785d9eb0f6f0bb64f7..7c2b9dfca7220747c77eb7396336116625ec2374 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=jcn1
+MY_PATCH_LEVEL=jcn2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 616e43125306c54148218ddf91ac3af809ee89ae..3e021dbc02cf00c54cbb1b7836eb1a0713af40aa 100644 (file)
 #include "debug.hh"
 #include "paper-column.hh"
 
-void
-Crescendo::set_interface (Score_element*s)
-{
-  s->set_elt_property ("dynamic-drul", gh_cons (SCM_EOL, SCM_EOL));
-}
-
-
-
-MAKE_SCHEME_CALLBACK(Crescendo,brew_molecule,1);
-
-/*
-
-  TODO:
-
-  * should span the crescendo on any dynamic-text items, and
-  calculate their dimensions to determine shortening; junk shortening
-  code and related elt props.
-
-  * separate the dashed-line version and the hairpin version into two
-  brew_molecule functions.
+MAKE_SCHEME_CALLBACK (Crescendo, brew_molecule, 1);
 
-  * generalise dashed-line into generic text spanner, for ottava, accelerando, etc.
-
-  
-*/
 SCM
 Crescendo::brew_molecule (SCM smob) 
 {
   Score_element *me= unsmob_element (smob);
-  Spanner * sp = dynamic_cast<Spanner*>(me);
-  Real ss = me->paper_l ()->get_var ("staffspace");
-  Real sl = me->paper_l ()->get_var ("stafflinethickness");  
+  Spanner *span = dynamic_cast<Spanner*>(me);
+  Real staff_space = me->paper_l ()->get_var ("staffspace");
+  Real line = me->paper_l ()->get_var ("stafflinethickness");  
   
-  Real absdyn_dim = gh_scm2double (me->get_elt_property ("shorten-for-letter"));
-  Real extra_left =  sp->get_broken_left_end_align ();
+  Real broken_left =  span->get_broken_left_end_align ();
 
-  SCM dir = me->get_elt_property("grow-direction");
-  SCM dyns = me->get_elt_property ("dynamic-drul");
-
-  if (!isdir_b (dir) || !gh_pair_p (dyns))
+  SCM s = me->get_elt_property("grow-direction");
+  if (!isdir_b (s))
     {
       me->suicide ();
       return SCM_EOL;
     }
   
-  Direction gd = to_dir (dir);
+  Direction grow_dir = to_dir (s);
 
-  bool dynleft= unsmob_element (gh_car (dyns));
-  bool dynright = unsmob_element (gh_cdr (dyns));
-  
-  if (dynleft)
-    extra_left += absdyn_dim;
-
-  Real width = sp->spanner_length()- sp->get_broken_left_end_align ();
-
-  if (dynleft)
-    {
-      width -= absdyn_dim;
-    }
-  if (dynright)
-    {
-      width -= absdyn_dim;
-    }
+  Real width = span->spanner_length ();
+  width -= span->get_broken_left_end_align ();
 
   if (width < 0)
     {
-      warning (_ ("crescendo") + " " + _ ("too small"));
+      warning (_ ((grow_dir < 0) ? "decrescendo too small"
+                 : "crescendo too small"));
       width = 0;
     }
 
@@ -89,68 +50,28 @@ Crescendo::brew_molecule (SCM smob)
   Direction d = LEFT;
   do
     {
-      Paper_column* s = dynamic_cast<Paper_column*>(sp->get_bound (d)); // UGH
+      Paper_column* s = dynamic_cast<Paper_column*> (span->get_bound (d)); // UGH
       broken[d] = (!s->musical_b ());
     }
   while (flip (&d) != LEFT);
   
-  Molecule m;
+  bool continued = broken[Direction (-grow_dir)];
+  Real height = staff_space * gh_scm2double (me->get_elt_property ("height"));
+  Real thick = line * gh_scm2double (me->get_elt_property ("thickness"));
   
-  Real pad = 0;
-  SCM s = me->get_elt_property ("start-text");
-  if (gh_string_p (s))
-    {
-      Molecule start_text (me->lookup_l ()->text ("italic",
-                                             ly_scm2string (s),
-                                                 me->paper_l ()));
-      m.add_molecule (start_text);
-
-      pad = me->paper_l ()->get_var ("staffspace") / 2;        //  ugh.
-
-      width -= start_text.extent (X_AXIS).length ();
-      width -= pad;
-      width = width >? 0;
-    }
-
-  SCM at;
-  s =me->get_elt_property ("spanner");
-  Real height;
-
-  if (gh_string_p (s) && ly_scm2string (s) == "dashed-line")
-    {
-      Real thick = gh_scm2double (me->get_elt_property ("dash-thickness")) * sl ;
-      Real dash = gh_scm2double (me->get_elt_property  ("dash-length")) * ss;
-      
-      height = thick;
-      at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()),
-                   gh_double2scm (thick),
-                   gh_double2scm (dash),
-                   gh_double2scm (width),
-                   SCM_UNDEFINED);
-    }
-  else
-    {
-      bool continued = broken[Direction (-gd)];
-      height = ss * gh_scm2double (me->get_elt_property ("height"));
-      Real thick = sl * gh_scm2double (me->get_elt_property ("thickness"));
-      
-      const char* hairpin = (gd < 0)? "decrescendo" :  "crescendo";
-
-      at = gh_list (ly_symbol2scm (hairpin),
+  const char* type = (grow_dir < 0) ? "decrescendo" :  "crescendo";
+  SCM hairpin = gh_list (ly_symbol2scm (type),
                    gh_double2scm (thick),
                    gh_double2scm (width),
                    gh_double2scm (height),
                    gh_double2scm (continued ? height/2 : 0.0),
                    SCM_UNDEFINED);
-    }
-  Box b (Interval (0, width), Interval (-2*height, 2*height));
-  Molecule span (b, at);
 
-  m.add_at_edge (X_AXIS, RIGHT, span, pad);
-  m.translate_axis (extra_left, X_AXIS);
+  Box b (Interval (0, width), Interval (-2*height, 2*height));
+  Molecule mol (b, hairpin);
+  mol.translate_axis (broken_left, X_AXIS);
 
-  return m.create_scheme ();
+  return mol.create_scheme ();
 }
 
 
index 3aead0adb74305bc58eb2b7e21955b78b211d7ff..d7bc14459fdd0392d2b4821978f3baa9e6f761b7 100644 (file)
@@ -228,64 +228,49 @@ Dynamic_engraver::do_process_music ()
       else
        {
          current_cresc_req_ = accepted_spanreqs_drul_[START];
-         cresc_p_  = new Spanner (get_property ("Crescendo"));
-         Crescendo::set_interface (cresc_p_);
-         cresc_p_->set_elt_property
-           ("grow-direction",
-            gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo")
-                        ? BIGGER : SMALLER));
-             
-         SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C());
-         if (gh_string_p (s))
-           {
-             cresc_p_->set_elt_property ("start-text", s);
-             daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
-                                           + "Text", SCM_UNDEFINED);
-           }
-
-         s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C());
-
 
          /*
            TODO: Use symbols.
           */
-         if (gh_string_p (s)) //&& ly_scm2string (s) != "hairpin")
+         SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C());
+
+         if (!gh_string_p (s) || ly_scm2string (s) == "hairpin")
            {
-             cresc_p_->set_elt_property ("spanner", s);
+             cresc_p_  = new Spanner (get_property ("Crescendo"));
+             cresc_p_->set_elt_property ("grow-direction",
+                                         gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo")
+                                                     ? BIGGER : SMALLER));
+             
+           }
+         /*
+           This is a convenient (and legacy) interface to TextSpanners
+           for use in (de)crescendi.
+           Hmm.
+          */
+         else
+           {
+             cresc_p_  = new Spanner (get_property ("TextSpanner"));
+             cresc_p_->set_elt_property ("type", s);
              daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
                                            + "Spanner", SCM_UNDEFINED);
+             s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C());
+             if (gh_string_p (s))
+               {
+                 cresc_p_->set_elt_property ("edge-text",
+                                             gh_cons (s, ly_str02scm ("")));
+                 daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_
+                                               + "Text", SCM_UNDEFINED);
+               }
            }
-
+       
          Score_element *cc = unsmob_element (get_property ("currentMusicalColumn"));
          cresc_p_->set_bound (LEFT, cc);
 
-
-         /* 
-             We know how wide the text is, if we can be sure that the
-             text already has relevant pointers into the paperdef,
-             and it has its font-size property set.
-
-             Since font-size may be set by a context higher up, we
-             can not be sure of the size.
-
-
-             We shouldn't try to do this stuff here, the Item should
-             do it when the score is finished.  We could maybe
-             set a callback to have the Item do the alignment if
-             it is not a special symbol, like Crescendo.
-         */
-
-         
          if (text_p_)
            {
-             index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"),
-                             LEFT, text_p_->self_scm ());
-
-             if (finished_cresc_p_
-             // I don't see why, but we need this check
-                 && gh_pair_p (finished_cresc_p_->get_elt_property ("dynamic-drul")))
-               index_set_cell (finished_cresc_p_->get_elt_property ("dynamic-drul"),
-                               RIGHT, text_p_->self_scm ());
+             Side_position::set_direction (text_p_, LEFT);
+             Side_position::set_axis (text_p_, X_AXIS);
+             Side_position::add_support (text_p_, cresc_p_);
            }
 
          Axis_group_interface::add_element (line_spanner_, cresc_p_);
index e7e4a16c522903b0a185ffe12770907a6fe33975..0fe05d839650f06c77675ebeaabae1079a5b01f6 100644 (file)
@@ -19,8 +19,7 @@
 struct Crescendo
 {
 public:
-  DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
-  static void set_interface(Score_element*);
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
   static bool has_interface (Score_element*);
 };
 
index d9e50012c3991253283cf7bf33279c79680de265..cb5768da58df6011918ff308c7df7b4bdd5e0ab9 100644 (file)
@@ -33,27 +33,20 @@ Span_arpeggio::brew_molecule (SCM smob)
   Score_element *me = unsmob_element (smob);
   
   Interval iv;
-  //Score_element *common = me;
-  Score_element *common = 0;
+  Score_element *common = me;
   for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
     {
       Score_element *arpeggio = unsmob_element (gh_car (s));
-      if (common)
-       common = arpeggio->common_refpoint (common, Y_AXIS);
-      else
-       common = arpeggio;
+      common = common->common_refpoint (arpeggio, Y_AXIS);
     }
-  if (0)  //common)
-    for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
-      {
-       Score_element *arpeggio = unsmob_element (gh_car (s));
-       // this dumps core: someone has no y-parent
-       Real c = common->relative_coordinate (arpeggio, Y_AXIS);
-       //iv.unite (Arpeggio::head_positions (stem));
-       iv.unite (Interval (c, c));
-      }
-  else
-    iv = Interval (-23, 5);
+  for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element *arpeggio = unsmob_element (gh_car (s));
+      Real c = arpeggio->relative_coordinate (common, Y_AXIS);
+      Interval height = arpeggio->extent (Y_AXIS);
+      iv.unite (height + c);
+    }
+  iv *= 0.5;
 
   Molecule mol;
   Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
@@ -64,7 +57,9 @@ Span_arpeggio::brew_molecule (SCM smob)
       a.translate_axis (i * staff_space, Y_AXIS);
       mol.add_molecule (a);
     }
-  mol.translate (Offset (-2 * staff_space, 0));
+  // huh?
+  Real dy = me->relative_coordinate (common, Y_AXIS);
+  mol.translate (Offset (-2 * staff_space, -2*dy));
 
   return mol.create_scheme (); 
 }