]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scm-option.cc
* lily/dots.cc (print): replace -
[lilypond.git] / lily / scm-option.cc
index d16d3df326a1d47b70eb5d628f4cc08af6c687d0..dac63fde4404009a0c34012d9577a913043eecd8 100644 (file)
@@ -6,12 +6,12 @@
   (c) 2001--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
  */
-#include <stdio.h>
 
-#include "parse-scm.hh"
-#include "string.hh"
-#include "lily-guile.hh"
 #include "scm-option.hh"
+
+#include <cstdio>
+
+#include "parse-scm.hh"
 #include "warn.hh"
 #include "main.hh"
 
@@ -32,6 +32,9 @@
 /* Write midi as formatted ascii stream? */
 bool midi_debug_global_b;
 
+int preview_resolution_global = 90;
+
+
 /* General purpose testing flag */
 int testing_level_global;
 
@@ -61,7 +64,7 @@ LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (SCM),
   puts ("");
   printf (_("  The function ly:set-option allows for access to some internal variables.").to_str0 ());
   puts ("\n");
-  printf (_ ("Usage: lilypond-bin -e \"(ly-set-option SYMBOL VAL)\"").to_str0 ());
+  printf (_ ("Usage: lilypond -e \"(ly:set-option SYMBOL VAL)\"").to_str0 ());
   puts ("\n");
   printf (_ ("Use help as  SYMBOL to get online help.").to_str0 ());
 
@@ -100,18 +103,18 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
 "@end table\n"
 "\n"
 "This function is useful to call from the command line: @code{lilypond -e\n"
-"\"(ly-set-option 'midi-debug #t)\"}.\n")
+"\"(ly:set-option 'midi-debug #t)\"}.\n")
 {
   if (val == SCM_UNDEFINED)
     val = SCM_BOOL_T;
 
   if (var == ly_symbol2scm ("help"))
-    /* lilypond -e "(ly-set-option 'help #t)" */
+    /* lilypond -e "(ly:set-option 'help #t)" */
     ly_option_usage (SCM_EOL);
   else if (var == ly_symbol2scm ("midi-debug"))
     midi_debug_global_b = to_boolean (val);
   else if (var == ly_symbol2scm ("testing-level"))
-    testing_level_global = ly_scm2int (val);
+    testing_level_global = scm_to_int (val);
   else if (var == ly_symbol2scm ("parse-protect" ))
     parse_protect_global = to_boolean (val);
   else if (var == ly_symbol2scm ("internal-type-checking"))
@@ -122,11 +125,13 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
       /*  Needs to be reset for each file that uses this option.  */
       lily_1_8_compatibility_used = false;
     }
+  else if (var == ly_symbol2scm ("resolution"))
+    preview_resolution_global = robust_scm2int (val, 90);
   else if (var == ly_symbol2scm ("new-relative"))
     lily_1_8_relative = false;
   else
     {
-      if (ly_c_symbol_p (var))
+      if (scm_is_symbol (var))
        var = scm_symbol_to_string (var);
       
       warning (_f ("No such internal option: %s", ly_scm2string (var)));
@@ -143,6 +148,8 @@ LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
           "Report whether old-relative compatibility mode is used\n"
           "@item verbose\n"
           "Report whether we are running in verbose mode\n"
+          "@item resolution\n"
+          "Resolution for the PNG output."
           "@end table\n"
           "\n")
 {
@@ -156,7 +163,16 @@ LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
     o = ly_bool2scm (lily_1_8_relative);
   else if (var == ly_symbol2scm ("verbose"))
     o = ly_bool2scm (verbose_global_b);
+  else if ( var == ly_symbol2scm ("resolution"))
+    o = scm_from_int (preview_resolution_global);
   else
-    warning (_f ("No such internal option: %s", ly_scm2string (var)));
+    {
+      if (scm_is_symbol (var))
+       var = scm_symbol_to_string (var);
+
+      String s = ly_scm2string (var);
+      
+      warning (_f ("No such internal option: %s", s.to_str0() ));
+    }
   return o;
 }