/*
- script.cc -- implement Script
+ script.cc -- implement Script
source file of the GNU LilyPond music typesetter
- (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
#include "script.hh"
#include "lookup.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
#include "paper-def.hh"
-#include "dimension-cache.hh"
-
+#include "item.hh"
Molecule
-Script::get_molecule(Direction d) const
+Script::get_molecule(Score_element * me, Direction d)
{
- SCM s = get_elt_property ("molecule");
- assert (s != SCM_UNDEFINED);
+ SCM s = me->get_elt_property ("molecule");
+ assert (gh_pair_p (s));
- SCM key = SCM_CAR (s);
+ SCM key = gh_car (s);
if (key == ly_symbol2scm ("feta"))
{
- return lookup_l ()->afm_find ("scripts-" +
+ return me->lookup_l ()->afm_find ("scripts-" +
ly_scm2string (index_cell (gh_cdr (s), d)));
}
else if (key == ly_symbol2scm ("accordion"))
{
- return lookup_l ()->accordion (s, paper_l()->get_var("interline"));
+ return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"));
}
-
- else assert (false);
+ else
+ assert (false);
return Molecule ();
}
-
-void
-Script::do_pre_processing ()
+MAKE_SCHEME_CALLBACK(Script,after_line_breaking);
+SCM
+Script::after_line_breaking (SCM smob)
{
- /*
- center my self on the note head.
- */
- Graphical_element * e = parent_l(X_AXIS);
- translate_axis (e->extent (X_AXIS).center (), X_AXIS);
+ Score_element * me = unsmob_element (smob);
+
+ Direction d = Side_position::get_direction (me);
+ Side_position::set_direction (me,d);
+
+ return SCM_UNSPECIFIED;
}
-void
-Script::do_post_processing ()
+MAKE_SCHEME_CALLBACK(Script,brew_molecule);
+
+SCM
+Script::brew_molecule (SCM smob)
{
- Direction d = Side_position_interface (this).get_direction ();
- Molecule m (get_molecule(d));
+ Score_element *me= unsmob_element (smob);
+// Direction dir = DOWN;
+// SCM d = me->get_elt_property ("direction");
+// if (isdir_b (d))
+// dir = to_dir (d);
+ Direction dir = Side_position::get_direction(me);
+ return get_molecule (me, dir).create_scheme();
}
-Molecule*
-Script::do_brew_molecule_p () const
+bool
+Script::has_interface (Score_element*me)
{
- Direction dir = DOWN;
- SCM d = get_elt_property ("direction");
- if (isdir_b (d))
- dir = to_dir (d);
-
- return new Molecule (get_molecule (dir));
+ return me->has_interface (ly_symbol2scm ("script-interface"));
}
-
-
+void
+Script::set_interface (Score_element*me)
+{
+ return me->set_interface (ly_symbol2scm ("script-interface"));
+}