]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ps-lookup.cc
release: 1.0.15
[lilypond.git] / lily / ps-lookup.cc
index cb839468a1d7ed9a99c8fcdd73be0b2dfd3a0ae4..8d160b1f88a50e98a77d873d832413bc73d9b61b 100644 (file)
 #include "string-convert.hh"
 #include "main.hh"
 #include "file-results.hh"
-#include "header.hh"
+#include "scope.hh"
 #include "paper-stream.hh"
 #include "ps-stream.hh"
 #include "ps-outputter.hh"
+#include "scope.hh"
+#include "dictionary-iter.hh"
+#include "identifier.hh"
 
 Ps_lookup::Ps_lookup ()
   : Lookup ()
@@ -112,6 +115,75 @@ Ps_lookup::hairpin (Real width, bool decresc, bool continued) const
   return a;
 }
 
+Lookup*
+Ps_lookup::lookup_p (Lookup const& l) const
+{
+  return new Ps_lookup (l);
+}
+
+Lookup*
+Ps_lookup::lookup_p (Symtables const& s) const
+{
+  return new Ps_lookup (s);
+}
+extern char const *lily_version_number_sz ();
+
+String
+header_to_ps_string (Scope *head)
+{
+  String s;
+  String lily_id_str = "Lily was here, " +
+    String (lily_version_number_sz ());
+  
+  s+= "/lily_id_string\n{" + lily_id_str + "} bind def\n";
+  
+  for (Dictionary_iter<Identifier*> i (*head); i.ok (); i++)
+    {
+      if (!i.val ()->access_String_identifier ())
+       continue;
+      
+      String val = *i.val()->access_String_identifier ()->data_p_;
+      
+      s += "/mudela" + i.key () + "{" + val + "} bind def\n";
+    }
+      
+  return s;
+}
+
+Paper_outputter*
+Ps_lookup::paper_outputter_p (Paper_stream* os_p, Paper_def* paper_l, Header* header_l, String origin_str) const
+{
+  if (header_global_p)
+    *os_p << header_to_ps_string (header_global_p);
+
+  *os_p << _ ("\n% outputting Score, defined at: ") << origin_str << '\n';
+
+  if (header_l)
+    {
+      *os_p << header_to_ps_string (header_l);
+    }
+
+  *os_p << paper_l->ps_output_settings_str ();
+
+  if (experimental_features_global_b)
+    *os_p << "turnOnExperimentalFeatures\n";
+
+  return new Ps_outputter (os_p);
+}
+
+Paper_stream*
+Ps_lookup::paper_stream_p () const
+{
+  String outname = base_output_str ();
+
+  if (outname != "-")
+    outname += ".ps";
+  *mlog << _f ("PostScript output to %s...", 
+              outname == "-" ? String ("<stdout>") : outname ) << endl;
+  target_str_global_array.push (outname);
+  return new Ps_stream (outname);
+}
+
 Atom
 Ps_lookup::plet (Real dy , Real dx, Direction dir) const
 {
@@ -186,6 +258,12 @@ Ps_lookup::text (String style, String text) const
   return Lookup::text (style, "(" + text + ")");
 }
 
+String
+Ps_lookup::unknown_str () const
+{
+  return "unknown ";
+}
+
 Atom
 Ps_lookup::vbracket (Real &y) const
 {