]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/lily-guile.cc (ly_chain_assoc): remove.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 27 Apr 2005 09:12:33 +0000 (09:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 27 Apr 2005 09:12:33 +0000 (09:12 +0000)
* lily/general-scheme.cc (LY_DEFINE): export ly:chain_assoc_get
(LY_DEFINE): recurse, iso. calling ly_chain_assoc.

ChangeLog
lily/all-font-metrics.cc
lily/beaming-info.cc
lily/font-select.cc
lily/general-scheme.cc
lily/lily-guile.cc
lily/main.cc
lily/pango-select.cc
scm/define-grobs.scm

index 2c06cc170a58c12e86fa1e29c54eeccafdc68543..4aa82750201317aceea98ed64fd1a57a83757546 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
+2005-04-27  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/lily-guile.cc (ly_chain_assoc): remove.
+
+       * lily/general-scheme.cc (LY_DEFINE): export ly:chain_assoc_get
+       (LY_DEFINE): recurse, iso. calling ly_chain_assoc.
+
 2005-04-26  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/beaming-info.cc: remove infinity_i
+
        * scripts/abc2ly.py (out_filename): fix thinko with \version.
 
 2005-04-26  Graham Percival  <gperlist@shaw.ca>
index 9ccc1f78ed6087ba1d15ab53c236e3e90010f25b..1273a3ae596feeb81160138edaff0a7d2d76ac8d 100644 (file)
@@ -74,7 +74,8 @@ All_font_metrics::find_pango_font (PangoFontDescription *description,
   SCM val;
   if (!pango_dict_->try_retrieve (key, &val))
     {
-      progress_indication ("[" + String (pango_fn));
+      if (be_verbose_global)
+       progress_indication ("[" + String (pango_fn));
       
       Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
                                       RIGHT,
index 78846cea7ea0ab3dfed4e28a1cd9eaf820a3bac7..50b94a6fb9d24b3e3aa7f56e6f43767a03cccc35 100644 (file)
@@ -22,13 +22,12 @@ Beaming_info::Beaming_info (Moment m, int i)
   beams_i_drul_[RIGHT] = i;
 }
 
-const int infinity_i = INT_MAX;        // guh.
-const int at_beat = 1<<15;
+const int at_beat = 1 << 15;
 
 int
 Beaming_info_list::best_splitpoint_index (Moment &beat_length, bool subdivide) const
 {
-  int minden = infinity_i;
+  int minden = INT_MAX;        
   int minidx = -1;
   Moment beat_pos;
 
index 9b5257c9c11a63f75aa1a94541f542a2ca83a902..144c0dd0104f49e973b7fe4281af5c1c7a12fa7a 100644 (file)
@@ -102,15 +102,13 @@ properties_to_font_size_family (SCM fonts, SCM alist_chain)
 Font_metric *
 select_encoded_font (Output_def *layout, SCM chain)
 {
-  SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
+  SCM name = ly_chain_assoc_get (ly_symbol2scm ("font-name"), chain, SCM_BOOL_F);
 
-  if (!scm_is_pair (name) || !scm_is_string (scm_cdr (name)))
+  if (!scm_is_string (name))
     {
       SCM fonts = layout->lookup_variable (ly_symbol2scm ("fonts"));
       name = properties_to_font_size_family (fonts, chain);
     }
-  else
-    name = scm_cdr (name);
 
 #if HAVE_PANGO_FT2
   if (scm_is_string (name)
@@ -122,10 +120,9 @@ select_encoded_font (Output_def *layout, SCM chain)
 #endif
     if (scm_is_string (name))
       {
-       SCM mag = ly_chain_assoc (ly_symbol2scm ("font-magnification"), chain);
-       Real rmag = (scm_is_pair (mag)
-                    ? robust_scm2double (scm_cdr (mag), 1.0)
-                    : 1);
+       Real rmag =
+         robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-magnification"), chain, SCM_BOOL_F),
+                            1.0);
        Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name));
 
        return find_scaled_font (layout, fm, rmag);
@@ -135,11 +132,9 @@ select_encoded_font (Output_def *layout, SCM chain)
        SCM base_size = scm_slot_ref (name, ly_symbol2scm ("default-size"));
        SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector"));
 
-       SCM font_size = ly_chain_assoc (ly_symbol2scm ("font-size"), chain);
-       Real req = 0;
-       if (scm_is_pair (font_size))
-         req = scm_to_double (scm_cdr (font_size));
-
+       Real req = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-size"), chain, SCM_BOOL_F),
+                                     0.0);
+       
        return get_font_by_mag_step (layout, req, vec,
                                     scm_to_double (base_size));
       }
index 73609b7b7aff0110cf1ee5df65f3d27bc670c17e..830cd6eaca4f45f056e6667810f0ff8238c231d1 100644 (file)
@@ -271,3 +271,20 @@ LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
 }
 
 
+
+LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
+          2, 1, 0, (SCM key, SCM achain, SCM dfault),
+          "Return value for @var{key} from a list of alists @var{achain}. Return @var{dfault} "
+          "if no entry is found, or #f if not specified. ")
+{
+  if (scm_is_pair (achain))
+    {
+      SCM handle = scm_assoc (key, scm_car (achain));
+      if (scm_is_pair (handle))
+       return scm_cdr (handle);
+      else
+       return ly_chain_assoc_get (key, scm_cdr (achain), dfault);
+    }
+  else
+    return dfault == SCM_UNDEFINED ? SCM_BOOL_F : dfault;
+}
index d4f16e936069949a551f3c8c270b420b2908ff9d..e485c86fecf2dedbf73e3b218ea47aa553884c81 100644 (file)
@@ -325,35 +325,7 @@ ly_deep_copy (SCM src)
   return src;
 }
 
-SCM
-ly_chain_assoc_get (SCM key, SCM achain, SCM dfault)
-{
-  if (scm_is_pair (achain))
-    {
-      SCM handle = scm_assoc (key, scm_car (achain));
-      if (scm_is_pair (handle))
-       return scm_cdr (handle);
-      else
-       return ly_chain_assoc (key, scm_cdr (achain));
-    }
-  else
-    return dfault;
-}
 
-SCM
-ly_chain_assoc (SCM key, SCM achain)
-{
-  if (scm_is_pair (achain))
-    {
-      SCM handle = scm_assoc (key, scm_car (achain));
-      if (scm_is_pair (handle))
-       return handle;
-      else
-       return ly_chain_assoc (key, scm_cdr (achain));
-    }
-  else
-    return SCM_BOOL_F;
-}
 
 /* looks the key up in the cdrs of the alist-keys
    - ignoring the car and ignoring non-pair keys.
index 252ebecf7fbf40bf2989ca4f7b4f0ac972171cad..dfc986ceb444d80362198ea4065322872405828e 100644 (file)
@@ -133,6 +133,10 @@ static Getopt_long *option_parser = 0;
 static Long_option_init options_static[]
 = {
   {_i ("BACK"), "backend", 'b', _i ("use backend BACK (gnome, ps [default],\n                                       scm, svg, tex, texstr)")},
+
+  {_i ("SYM=VAL"), "define-default", 'd',
+   _i ("define a default Scheme setting.")},
+
   {_i ("EXPR"), "evaluate", 'e', _i ("set scheme option, for help use\n                                       -e '(ly:option-usage)'")},
   /* Bug in option parser: --output =foe is taken as an abbreviation
      for --output-format.  */
@@ -473,6 +477,10 @@ parse_argv (int argc, char **argv)
            make_print = false;
          break;
 
+       case 'd':
+         
+         break;
+         
        case 'v':
          notice ();
          exit (0);
index 708720486ecffea6a713c9452483813bb0392110..7ca70983ffea86189b9f429459dadbdd46170d2b 100644 (file)
 PangoFontDescription *
 properties_to_pango_description (SCM chain, Real text_size)
 {
-  SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
+  SCM name = ly_chain_assoc_get (ly_symbol2scm ("font-name"), chain, SCM_BOOL_F);
 
   PangoFontDescription *description = 0;
-  if (scm_is_pair (name) && scm_is_string (scm_cdr (name)))
+  if (scm_is_string (name))
     {
-      String name_str = ly_scm2string (scm_cdr (name));
+      String name_str = ly_scm2string (name);
       description = pango_font_description_from_string (name_str.to_str0 ());
     }
   else
index 2df163e93fd7373b8803fd4d94bade53ede860ec..4564baa595f47261b2d529ee17812f455378ca24 100644 (file)
      . (
        (print-function . ,Grid_line_interface::print)
        (X-extent-callback  . ,Grid_line_interface::width_callback)
+       (self-alignment-X . ,CENTER)
+       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
+                              ,Self_alignment_interface::centered_on_parent))
        (layer . 0)
        (meta . ((interfaces . (grid-line-interface)))
        )))