]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.65
authorfred <fred>
Sun, 24 Mar 2002 19:44:34 +0000 (19:44 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:44:34 +0000 (19:44 +0000)
lily/include/text-spanner.hh
lily/text-spanner.cc

index dbdea979ad25a1e277bd12643983806adb9472a2..a91d8d96910d3c49e1afe7cb4400ab4645823360 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  textspanner.hh -- part of LilyPond
+  textspanner.hh -- part of GNU LilyPond
 
   (c) 1996,97 Han-Wen Nienhuys
 */
 
 /** a spanner which puts texts on top of other spanners.  Use for
   triplets, eentweetjes, ottava, etc.  */
-struct Text_spanner : Spanner {
+class Text_spanner : public Spanner {
+public:
+    Directional_spanner * support;
     Text_def spec;
     Offset text_off_;
-    Directional_spanner*support;
+    NAME_MEMBERS(Text_spanner);
 
-    /* *************** */
+    void set_support(Directional_spanner*);
+    Text_spanner();
+protected:
+    SPANNER_CLONE(Text_spanner)
 
-    NAME_MEMBERS(Text_spanner);
+    virtual void do_substitute_dependency(Score_elem*,Score_elem*);
     virtual void do_pre_processing();
     virtual void do_post_processing();
     virtual Interval height() const ;
     virtual Molecule* brew_molecule_p()const;
     virtual void do_print() const;
-    virtual Spanner* do_break_at(PCol*,PCol*)const;
-    Text_spanner();
-    void set_support(Directional_spanner*);
 };
 #endif // TEXTSPANNER_HH
 
index 2858a28641481b78220eabb4afa57fccdfeeba99..6883dab0b0d4bcd7fb2a74d5f70846eb7ff78a68 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  text-spanner.cc -- implement Text_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "molecule.hh"
 #include "boxes.hh"
 #include "text-spanner.hh"
 void
 Text_spanner::set_support(Directional_spanner*d)
 {
-    support = d;
+    if (support)
+       remove_dependency(support);
+    
+    support =d;
     add_dependency(d);
 }
 
@@ -33,7 +44,7 @@ Text_spanner::do_post_processing()
     switch(spec.align_i_) {
     case 0:
        text_off_ = support->center() +
-           Offset(0,support->dir_i_ * paper()->internote() * 4); // todo
+           Offset(0,support->dir_i_ * paper()->internote_f() * 4); // todo
        break;
     default:
        assert(false);
@@ -67,8 +78,11 @@ Text_spanner::height()const
     return brew_molecule_p()->extent().y;
 }
 
-Spanner*
-Text_spanner::do_break_at(PCol*c1, PCol*c2)const
+void
+Text_spanner::do_substitute_dependency(Score_elem* o, Score_elem*n)
 {
-    return new Text_spanner(*this); // todo
+    Directional_spanner * old = (Directional_spanner*)o->spanner();
+    if (support == old)
+       support = (Directional_spanner*) n->spanner();
 }
+