]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/p-score.cc
release: 1.1.28
[lilypond.git] / lily / p-score.cc
index 48f2e400acef5f5ddbb89a9df9ef54e5ad50517b..f7b4238de813b3a9a109178e72d999c89b499e40 100644 (file)
 #include "plist.hh"
 #include "p-col.hh"
 #include "p-score.hh"
-#include "tex-stream.hh"
 #include "p-col.hh"
-#include "header.hh"
+#include "scope.hh"
 #include "word-wrap.hh"
 #include "gourlay-breaking.hh"
-#include "tex-outputter.hh"
+#include "paper-stream.hh"
+#include "paper-outputter.hh"
 #include "file-results.hh"
 #include "misc.hh"
 
+#if 1                  // has w32 advanced?
+                       // nope (cygwin-b20)
+
 // sucking Cygnus egcs - w32
 #include "list.tcc"
 #include "cursor.tcc"
 
+#endif
+
 Paper_score::Paper_score ()
 {
   outputter_l_ =0;
@@ -40,18 +45,6 @@ Paper_score::Paper_score ()
 
 Paper_score::~Paper_score ()
 {
-#if 0
-  for (int i=0; i< line_l_arr_.size (); i++)
-    line_l_arr_[i]->unlink_all ();
-
-  for (PCursor<Score_element*> i(elem_p_list_.top()); i.ok(); i++)
-    {
-
-      if (i->linked_b())
-       i->unlink ();
-      assert (! i->linked_b ());
-    }
-#endif
 }
 
 void
@@ -127,38 +120,6 @@ Paper_score::find_col (Paper_column const *c) const
 }
 
 
-#if 0
-void
-Paper_score::set_breaking (Array<Column_x_positions> const &breaking)
-{
-  for (iter (span_p_list_.top (),i); i.ok  ();)
-    {
-      Spanner *span_p = i.remove_p ();
-      if (span_p->broken_b ()
-         || !((Score_element*)span_p)->line_l ())
-       {
-         span_p->unlink ();
-         delete span_p;
-       }
-      else 
-       {
-         typeset_broken_spanner (span_p);
-       }
-    }
-  for (iter (elem_p_list_.top (),i); i.ok  () ;)
-    {
-      Item *i_l =i->access_Item ();
-      if (i_l && !i_l->line_l ())
-       {
-         i_l->unlink ();
-         Score_element * item_p= i.remove_p ();
-         delete item_p;
-       }
-      else
-       i++;
-    }
-}
-#endif
 
 
 Array<Column_x_positions>
@@ -190,6 +151,8 @@ Paper_score::calc_breaking ()
   return sol;
 }
 
+
+
 void
 Paper_score::process ()
 {
@@ -203,8 +166,9 @@ Paper_score::process ()
       line_l_->space_processing ();
 
   Array<Column_x_positions> breaking = calc_breaking ();
-  Tex_stream *tex_stream_p = open_output_stream ();
-  outputter_l_=open_tex_outputter (tex_stream_p);
+
+  Paper_stream* paper_stream_p = paper_l_->paper_stream_p ();
+  outputter_l_ = paper_l_->paper_outputter_p (paper_stream_p, header_l_, origin_str_);
 
   Link_array<Line_of_score> lines;
   for (int i=0; i < breaking.size (); i++)
@@ -228,14 +192,15 @@ Paper_score::process ()
       line_l->output_all ();
        *mlog << ']' << flush;
       remove_line (line_l);
-       
     }
-  *tex_stream_p << "\n\\EndLilyPondOutput";
+  
+  // huh?
   delete outputter_l_;
-  delete tex_stream_p;
+  delete paper_stream_p;
   outputter_l_ = 0;
-}
 
+  *mlog << '\n' << flush;
+}
 
 void
 Paper_score::remove_line (Line_of_score *l)
@@ -267,61 +232,6 @@ Paper_score::remove_line (Line_of_score *l)
     }
 }
 
-Tex_stream *
-Paper_score::open_output_stream ()
-{
-  // output
-  String base_outname = paper_l_->outfile_str_ ;
-  if (base_outname.empty_b ())
-    {
-      base_outname = default_outname_base_global;
-      int def = paper_l_->get_next_default_count ();
-      if (def)
-       {
-         base_outname += "-" + to_str (def);
-       }
-    }
-
-  String outname = base_outname;
-  if (outname != "-")
-     outname += ".tex";
-  target_str_global_array.push (outname);
-
-  *mlog << _f ("TeX output to %s...", 
-    outname == "-" ? String ("<stdout>") : outname ) << endl;
-
-  return  new Tex_stream (outname);
-}
-
-
-
-Tex_outputter *
-Paper_score::open_tex_outputter (Tex_stream *tex_out_p)
-{
-  Tex_outputter *interfees_p= new Tex_outputter (tex_out_p);
-
-  if (header_global_p)
-    {
-      *tex_out_p << header_global_p->TeX_string ();
-    }
-    
-  
-  *tex_out_p << _ ("% outputting Score, defined at: ") << origin_str_ << '\n';
-
-  if (header_l_)
-    {
-      *tex_out_p << header_l_->TeX_string();
-    }
-  *tex_out_p << paper_l_->TeX_output_settings_str ();
-  
-
-  if (experimental_features_global_b)
-    *tex_out_p << "\\turnOnExperimentalFeatures%\n";
-
-  *tex_out_p << "\\turnOnPostScript%\n";
-  return interfees_p;
-}
-
 /** Get all breakable columns between l and r, (not counting l and r).  */
 Link_array<Paper_column>
 Paper_score::breakable_col_range (Paper_column*l, Paper_column*r) const
@@ -370,12 +280,17 @@ Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const
   Item const*l=l_item_l;
   Item const*r=r_item_l;
 
-  while (! l->is_type_b(Paper_column::static_name ()))
-    l = l->axis_group_l_a_[X_AXIS]->access_Score_element ()->access_Item ();
-
-  while (! r->is_type_b(Paper_column::static_name ()))
-    r = r->axis_group_l_a_[X_AXIS]->access_Score_element ()->access_Item ();
-
+  // huh? see Item::left_right_compare ()
+  /*
+  while (! (dynamic_cast<Paper_column const *> (l)))
+    l = dynamic_cast<Item*> (l->axis_group_l_a_[X_AXIS]);
+
+  while (! (dynamic_cast<Paper_column const *> (r)))
+    r = dynamic_cast<Item*>(r->axis_group_l_a_[X_AXIS]);
+  */
+  l = l->column_l ();
+  r = r->column_l ();
+  
   PCursor<Paper_column*> start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ());
   PCursor<Paper_column*> stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ());