]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol-engraver.cc
Only issue warning about running configure
[lilypond.git] / lily / staff-symbol-engraver.cc
index e666f3b87ffbbf1ba22b93a17e23308afdb58648..17e96949b4b3fdf4f2b14668fca6d3988d1e78cd 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
   Manage the staff symbol.
  */
 class Staff_symbol_engraver : public Engraver { 
-  Spanner *span_;
 public:
   TRANSLATOR_DECLARATIONS(Staff_symbol_engraver);
   
 protected:
+  Spanner *span_;
+  
   virtual ~Staff_symbol_engraver ();
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
-  virtual void initialize ();
+  virtual void process_music ();
 };
 
 
@@ -41,27 +42,33 @@ Staff_symbol_engraver::Staff_symbol_engraver ()
 }
 
 void
-Staff_symbol_engraver::initialize ()
+Staff_symbol_engraver::process_music ()
 {
-  span_ = new Spanner (get_property ("StaffSymbol"));
+  if (!span_)
+    {
+      span_ = make_spanner ("StaffSymbol");
   
-  span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+      span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
 
-  announce_grob(span_, SCM_EOL);
+      announce_grob(span_, SCM_EOL);
+    }
 }
 
 void
 Staff_symbol_engraver::finalize ()
 {
-  span_->set_bound (RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
-  typeset_grob (span_);
+  if (span_)
+    {
+      span_->set_bound (RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
+      typeset_grob (span_);
+    }
   span_ =0;
 }
 
 void
 Staff_symbol_engraver::acknowledge_grob (Grob_info s)
 {
-  s.grob_->set_grob_property ("staff-symbol", span_->self_scm ());
+  s.grob_->set_property ("staff-symbol", span_->self_scm ());
 
   // remove this. probly not necessary?
   s.grob_->add_dependency (span_); // UGH. UGH. UGH
@@ -71,10 +78,47 @@ Staff_symbol_engraver::acknowledge_grob (Grob_info s)
 
 
 ENTER_DESCRIPTION(Staff_symbol_engraver,
-/* descr */       "create the constellation of five (default)
-staff lines.",
+/* descr */       "Create the constellation of five (default) "
+"staff lines.",
 /* creats*/       "StaffSymbol",
 /* accepts */     "",
 /* acks  */      "grob-interface",
 /* reads */       "",
 /* write */       "");
+
+/****************************************************************/
+
+
+class Tab_staff_symbol_engraver : public Staff_symbol_engraver
+{
+public:
+  TRANSLATOR_DECLARATIONS(Tab_staff_symbol_engraver);
+protected:
+  virtual void process_music ();
+};
+
+void
+Tab_staff_symbol_engraver::process_music ()
+{
+  bool init = !span_;
+  Staff_symbol_engraver::process_music();
+  if (init)
+    {
+      int k = scm_ilength (get_property ("stringTunings"));
+      if (k>=0)
+       span_->set_property ("line-count", gh_int2scm (k));
+    }
+}
+
+Tab_staff_symbol_engraver::Tab_staff_symbol_engraver()
+{
+}
+
+ENTER_DESCRIPTION(Tab_staff_symbol_engraver,
+/* descr */       "Create a staff-symbol, but look at stringTunings for the number of lines."
+"staff lines.",
+/* creats*/       "StaffSymbol",
+/* accepts */     "",
+/* acks  */      "grob-interface",
+/* reads */       "stringTunings",
+/* write */       "");