Correct left text alignment of DynamicTextSpanner.
[lilypond.git] / lily / listener.cc
blobc8202a9d345d6ef8d9d0fabe066d688cd380a5e6
1 /*
2 listener.cc -- implement Listener and Listener_target
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Erik Sandberg <mandolaerik@gmail.com>
7 */
9 #include "listener.hh"
10 #include "ly-smobs.icc"
11 #include "warn.hh"
13 Listener::Listener ()
15 target_ = 0;
16 type_ = 0;
19 Listener::Listener (const void *target, Listener_function_table *type)
21 target_ = (void *)target;
22 type_ = type;
25 Listener::Listener (Listener const &other)
27 target_ = other.target_;
28 type_ = other.type_;
31 void Listener::listen (SCM ev) const {
32 (type_->listen_callback) (target_, ev);
35 SCM
36 Listener::mark_smob (SCM sm)
38 Listener *me = (Listener *) SCM_CELL_WORD_1 (sm);
39 if (me->type_)
40 (me->type_->mark_callback) (me->target_);
41 return SCM_EOL;
44 int
45 Listener::print_smob (SCM, SCM p, scm_print_state*)
47 scm_puts ("#<Listener>", p);
48 return 1;
51 SCM
52 Listener::equal_p (SCM a, SCM b)
54 Listener *l1 = unsmob_listener (a);
55 Listener *l2 = unsmob_listener (b);
57 return (*l1 == *l2) ? SCM_BOOL_T : SCM_BOOL_F;
60 IMPLEMENT_SIMPLE_SMOBS (Listener);
61 IMPLEMENT_TYPE_P (Listener, "listener");