]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/clef-engraver.cc
Imported sources
[lilypond.git] / lily / clef-engraver.cc
index 091ee979a0bb8a0fd93b235b18530ce8c7a26f9c..76c814444f48f23c19e0689ff0d43bef56f18525 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
 
   Mats Bengtsson <matsb@s3.kth.se>
 */
 #include <ctype.h>
 
 #include "translator-group.hh"
-
 #include "bar-line.hh"
 #include "staff-symbol-referencer.hh"
-
 #include "engraver.hh"
 #include "direction.hh"
 #include "side-position-interface.hh"
 #include "item.hh"
 
-
 class Clef_engraver : public  Engraver
 {
 public:
@@ -30,7 +27,6 @@ public:
 
 protected:
   virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
   virtual void process_music ();
   virtual void acknowledge_grob (Grob_info);
 private:
@@ -65,8 +61,8 @@ Clef_engraver::set_glyph ()
 
   SCM basic = ly_symbol2scm ("Clef");
   
-  daddy_trans_->execute_single_pushpop_property (basic, glyph_sym, SCM_UNDEFINED);
-  daddy_trans_->execute_single_pushpop_property (basic, glyph_sym, glyph);
+  execute_pushpop_property (daddy_trans_, basic, glyph_sym, SCM_UNDEFINED);
+  execute_pushpop_property (daddy_trans_, basic, glyph_sym, glyph);
 }
 
 /** 
@@ -82,7 +78,6 @@ Clef_engraver::acknowledge_grob (Grob_info info)
       if (Bar_line::has_interface (info.grob_)
          && gh_string_p (get_property ("clefGlyph")))
        create_clef ();
-
     } 
 }
 
@@ -91,7 +86,7 @@ Clef_engraver::create_clef ()
 {
   if (!clef_)
     {
-      Item *c= new Item (get_property ("Clef"));
+      Item *c= make_item ("Clef");
       announce_grob(c, SCM_EOL);
 
       clef_ = c;
@@ -103,14 +98,20 @@ Clef_engraver::create_clef ()
       SCM oct =  get_property ("clefOctavation");
       if (gh_number_p (oct) && gh_scm2int (oct))
        {
-         Item * g = new Item (get_property ("OctavateEight"));
-
+         Item * g = make_item ("OctavateEight");
+
+         int abs_oct = gh_scm2int (oct) ;
+         int dir = sign (abs_oct);
+         abs_oct = abs (abs_oct)  + 1;
+           
+         g->set_grob_property ("text",
+                               scm_number_to_string (gh_int2scm (abs_oct),
+                                                     SCM_MAKINUM (10)));
          Side_position_interface::add_support (g,clef_);      
 
          g->set_parent (clef_, Y_AXIS);
          g->set_parent (clef_, X_AXIS);
-
-         g->set_grob_property ("direction", scm_int2num (sign (gh_scm2int (oct))));
+         g->set_grob_property ("direction", scm_int2num (dir));
          octavate_ = g;
          announce_grob(octavate_, SCM_EOL);
        }
@@ -134,8 +135,7 @@ Clef_engraver::inspect_clef_properties ()
       || scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F
       || scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F
       || scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
-      || to_boolean (force_clef)
-)
+      || to_boolean (force_clef))
     {
       set_glyph ();
       create_clef ();
@@ -181,7 +181,6 @@ Clef_engraver::stop_translation_timestep ()
 
       if (octavate_)
        {
-         Side_position_interface::add_staff_support (octavate_);         
          typeset_grob (octavate_);
        }
 
@@ -189,16 +188,12 @@ Clef_engraver::stop_translation_timestep ()
     }
 }
 
-void
-Clef_engraver::start_translation_timestep ()
-{
-}
-
 
 
 ENTER_DESCRIPTION(Clef_engraver,
 /* descr */       "Determine and set reference point for pitches",
 /* creats*/       "Clef OctavateEight",
-/* acks  */       "bar-line-interface",
+/* accepts */     "",
+/* acks  */      "bar-line-interface",
 /* reads */       "clefPosition clefGlyph centralCPosition clefOctavation explicitClefVisibility",
 /* write */       "");