/*
- 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
+/*
+ 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);
}
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);
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();
}
+