TRANSLATOR_DECLARATIONS(Figured_bass_engraver);
protected:
- Link_array<Note_req> figures_;
+ Link_array<Bass_figure_req> figures_;
Rest_req * rest_req_;
Grob * figure_;
if (figure_)
{
typeset_grob (figure_);
- figure_ =00;
+ figure_ = 0;
}
figures_.clear ();
bool
Figured_bass_engraver::try_music (Music*m)
{
- if (Note_req* n = dynamic_cast<Note_req*> (m))
+ if (Bass_figure_req* bfr = dynamic_cast<Bass_figure_req*> (m))
{
- figures_.push (n);
+ figures_.push (bfr);
return true;
}
else if (Rest_req * r = dynamic_cast<Rest_req*> (m))
else if (figures_.size ())
{
figure_ = new Item (get_property ("BassFigure"));
- announce_grob(figure_, figures_[0]->self_scm()); // todo
- SCM flist = SCM_EOL;
- for (int i = 0; i < figures_.size (); i++)
- {
- Note_req * n = figures_[i];
- Pitch *p = unsmob_pitch (n->get_mus_property ("pitch"));
-
- String fstr = to_str (p->steps ()+ 1);
-
- SCM one_fig = ly_str02scm(fstr.ch_C ());
-
- if (p->alteration_i_ || to_boolean (n->get_mus_property ("force-accidental") ))
- {
- SCM alter = scm_assoc (gh_int2scm (p->alteration_i_),
- figure_->get_grob_property ("accidental-alist"));
- if (gh_pair_p (alter))
- {
- one_fig = scm_list_n (ly_symbol2scm ("columns"),
- one_fig,
- ly_cdr(alter),
- SCM_UNDEFINED);
- }
- }
-
- flist = gh_cons (one_fig, flist);
- }
+ SCM l = SCM_EOL;
- flist = gh_cons (ly_symbol2scm ("lines"), flist);
-
- figure_-> set_grob_property ("text", flist);
+ for (int i = 0; i <figures_.size (); i++)
+ l = gh_cons (figures_[i]->self_scm(), l);
+ figure_->set_grob_property ("causes", l);
+
+ announce_grob(figure_, figures_[0]->self_scm()); // todo
}
}
Molecule::ly_set_molecule_extent_x (SCM mol, SCM axis, SCM np)
{
Molecule* m = unsmob_molecule (mol);
- if (m && ly_axis_p (axis) && ly_number_pair_p (np))
- {
- Interval iv = ly_scm2interval (np);
- m->dim_[Axis (gh_scm2int (axis))] = iv;
- }
- else
- warning ("ly-set-molecule-extent!: invalid arguments");
+ SCM_ASSERT_TYPE (m, mol, SCM_ARG1, __FUNCTION__, "molecule");
+ SCM_ASSERT_TYPE (ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+ SCM_ASSERT_TYPE (ly_number_pair_p (np), np, SCM_ARG3, __FUNCTION__, "number pair");
+
+ Interval iv = ly_scm2interval (np);
+ m->dim_[Axis (gh_scm2int (axis))] = iv;
+
return SCM_UNDEFINED;
}
SCM
Molecule::ly_molecule_combined_at_edge (SCM first, SCM axis, SCM direction,
- SCM second, SCM padding)
+ SCM second, SCM padding)
{
Molecule * m1 = unsmob_molecule (first);
Molecule * m2 = unsmob_molecule (second);
Molecule result;
-
- if (!m1 || !m2 || !isdir_b (direction) || !ly_axis_p (axis) || !gh_number_p (padding))
- {
- warning ("ly-combine-molecule-at-edge: invalid arguments");
- Molecule r;
- return r.smobbed_copy ();
- }
- result = *m1;
- result.add_at_edge (Axis (gh_scm2int (axis)), Direction (gh_scm2int (direction)),
- *m2, gh_scm2double (padding));
+ SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+ SCM_ASSERT_TYPE(isdir_b (direction), direction, SCM_ARG3, __FUNCTION__, "dir");
+ SCM_ASSERT_TYPE(gh_number_p(padding), padding, SCM_ARG4, __FUNCTION__, "number");
+
+ if (m1)
+ result = *m1;
+ if (m2)
+ result.add_at_edge (Axis (gh_scm2int (axis)), Direction (gh_scm2int (direction)),
+ *m2, gh_scm2double (padding));
return result.smobbed_copy ();
}
return m.smobbed_copy ();
}
+SCM
+fontify_atom (Font_metric * met, SCM f)
+{
+ if (f == SCM_EOL)
+ return f;
+ else
+ return scm_list_n (ly_symbol2scm ("fontify"),
+ ly_quote_scm (met->description_), f, SCM_UNDEFINED);
+}
+
+SCM
+ly_fontify_atom (SCM met, SCM f)
+{
+ SCM_ASSERT_TYPE(unsmob_metrics (met), met, SCM_ARG1, __FUNCTION__, "font metric");
+
+ return fontify_atom (unsmob_metrics (met), f);
+}
+
+SCM
+ly_align_to_x (SCM mol, SCM axis, SCM dir)
+{
+ SCM_ASSERT_TYPE(unsmob_molecule (mol), mol, SCM_ARG1, __FUNCTION__, "molecule");
+ SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+ SCM_ASSERT_TYPE(isdir_b (dir), dir, SCM_ARG3, __FUNCTION__, "dir");
+
+ unsmob_molecule (mol)->align_to ((Axis)gh_scm2int (axis), Direction (gh_scm2int (dir)));
+
+ return SCM_UNDEFINED;
+}
+
static void
molecule_init ()
{
scm_c_define_gsubr ("ly-make-molecule", 3, 0, 0, (Scheme_function_unknown) make_molecule);
+ scm_c_define_gsubr ("ly-fontify-atom", 2, 0, 0, (Scheme_function_unknown) ly_fontify_atom);
+ scm_c_define_gsubr ("ly-align-to!", 3, 0, 0, (Scheme_function_unknown) ly_align_to_x);
scm_c_define_gsubr ("ly-combine-molecule-at-edge", 5 , 0, 0, (Scheme_function_unknown) Molecule::ly_molecule_combined_at_edge);
scm_c_define_gsubr ("ly-set-molecule-extent!", 3 , 0, 0, (Scheme_function_unknown) Molecule::ly_set_molecule_extent_x);
scm_c_define_gsubr ("ly-get-molecule-extent", 2 , 0, 0, (Scheme_function_unknown) Molecule::ly_get_molecule_extent);
return expr_ == SCM_EOL;
}
-SCM
-fontify_atom (Font_metric * met, SCM f)
-{
- if (f == SCM_EOL)
- return f;
- else
- return scm_list_n (ly_symbol2scm ("fontify"),
- ly_quote_scm (met->description_), f, SCM_UNDEFINED);
-}
-
SCM
Molecule::get_expr () const
{