source file of the GNU LilyPond music typesetter
- (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "dimensions.hh"
-#include "musical-request.hh"
-#include "paper-column.hh"
#include "note-column.hh"
#include "item.hh"
#include "side-position-interface.hh"
#include "engraver.hh"
-#include "group-interface.hh"
-#include "directional-element-interface.hh"
-#include "translator-group.hh"
-#include "axis-group-interface.hh"
-
class Text_spanner_engraver : public Engraver
{
virtual void acknowledge_grob (Grob_info);
virtual bool try_music (Music *);
virtual void stop_translation_timestep ();
- virtual void start_translation_timestep ();
virtual void process_music ();
private:
Spanner *span_;
Spanner *finished_;
- Span_req *current_req_;
- Drul_array<Span_req*> req_drul_;
+ Music *current_req_;
+ Drul_array<Music*> req_drul_;
void typeset_all ();
};
-
-
Text_spanner_engraver::Text_spanner_engraver ()
{
finished_ = 0;
req_drul_[STOP] = 0;
}
-void
-Text_spanner_engraver::start_translation_timestep ()
-{
- req_drul_[START] = 0;
- req_drul_[STOP] = 0;
-}
-
bool
Text_spanner_engraver::try_music (Music *m)
{
- if (Span_req *s = dynamic_cast <Span_req*> (m))
+ if (m->is_mus_type ("text-span-event"))
{
- String t = ly_scm2string (s->get_mus_property ("span-type"));
- if (t == "abort")
- {
- req_drul_[LEFT] = 0;
- req_drul_[RIGHT] = 0;
- if (span_)
- span_->suicide ();
- span_ = 0;
- }
- else if (t == "text")
- {
- req_drul_[s->get_span_dir ()] = s;
- return true;
- }
+
+ Direction d = to_dir (m->get_mus_property ("span-direction"));
+ req_drul_[d] = m;
+ return true;
}
+
return false;
}
else
{
current_req_ = req_drul_[START];
- span_ = new Spanner (get_property ("TextSpanner"));
+ span_ = make_spanner ("TextSpanner");
- /* Ugh. Reset (de)cresc. specific properties */
- span_->set_grob_property ("outer", SCM_BOOL_T);
- span_->set_grob_property ("if-text-padding", gh_double2scm (0));
- span_->set_grob_property ("width-correct", gh_double2scm (0));
-
+
Side_position_interface::set_axis (span_, Y_AXIS);
announce_grob (span_, req_drul_[START]->self_scm());
req_drul_[START] = 0;
{
if (finished_)
{
- Side_position_interface::add_staff_support (finished_);
-
if (!finished_->get_bound (RIGHT))
{
Grob* e = unsmob_grob (get_property ("currentMusicalColumn"));
- span_->set_bound (RIGHT, e);
+ finished_->set_bound (RIGHT, e);
}
typeset_grob (finished_);
finished_ = 0;
}
typeset_all ();
+ req_drul_[START] = 0;
+ req_drul_[STOP] = 0;
}
void
}
ENTER_DESCRIPTION(Text_spanner_engraver,
-/* descr */ "Create text spanner from a Span_req.",
+/* descr */ "Create text spanner from a Music.",
/* creats*/ "TextSpanner",
-/* acks */ "note-column-interface",
+/* accepts */ "text-span-event",
+/* acks */ "note-column-interface",
/* reads */ "",
/* write */ "");