- for (int i = 0; i < sub_arr.size (); i++)
- {
- Musical_pitch p = sub_arr[i];
- int step = Chord::step_i (tonic, p);
- /*
- if additions include 2 or 4, assume sus2/4 and don't display 'no3'
- */
- if (!((step == 3) && (has[2] || has[4])))
- {
- add_str += sep_str + "no" + to_str (step);
- sep_str = "/";
- }
- }
-
- if (mod_str.length_i ())
- name_p->modifier_mol.add_at_edge (X_AXIS, RIGHT,
- lookup_l ()->text ("roman", mod_str, paper_l ()), 0);
- if (add_str.length_i ())
- {
- if (!name_p->addition_mol.empty_b ())
- add_str = "/" + add_str;
- name_p->addition_mol.add_at_edge (X_AXIS, RIGHT,
- lookup_l ()->text ("script", add_str, paper_l ()), 0);
- }
-}
-
-/*
- TODO:
- fix silly to-and-fro scm conversions
- */
-Molecule
-Chord_name::do_brew_molecule () const
-{
- Array<Musical_pitch> pitch_arr;
-
- for (SCM s = get_elt_property ("pitches"); s != SCM_EOL; s = gh_cdr (s))
- pitch_arr.push (Musical_pitch (gh_car (s)));
-
- Musical_pitch tonic = pitch_arr[0];
-
- Chord_mol name;
- name.tonic_mol = pitch2molecule (tonic);
-
- /*
- if user has explicitely listed chord name, use that
-
- TODO
- urg
- maybe we should check all sub-lists of pitches, not
- just full list and base triad?
- */
- if (!user_chord_name (pitch_arr, &name))
- {
- /*
- else, check if user has listed base triad
- use user base name and add banter for remaining part
- */
- if ((pitch_arr.size () > 2)
- && user_chord_name (pitch_arr.slice (0, 3), &name))
- {
- Array<Musical_pitch> base = Chord::base_arr (tonic);
- base.concat (pitch_arr.slice (3, pitch_arr.size ()));
- banter (base, &name);
- }
- /*
- else, use pure banter
- */
- else
- {
- banter (pitch_arr, &name);
- }
- }
-
- SCM s = get_elt_property ("inversion");
- if (s != SCM_UNDEFINED)
- {
- name.inversion_mol = lookup_l ()->text ("", "/", paper_l ());
- Musical_pitch p (s);
-
- Molecule mol = pitch2molecule (p);
- name.inversion_mol.add_at_edge (X_AXIS, RIGHT, mol, 0);
- }
-
- s = get_elt_property ("bass");
- if (s != SCM_UNDEFINED)
- {
- name.bass_mol = lookup_l ()->text ("", "/", paper_l ());
- Musical_pitch p (s);
- Molecule mol = pitch2molecule (p);
- name.bass_mol.add_at_edge (X_AXIS, RIGHT, mol, 0);
- }
-
- // urg, howto get a good superscript_y?
- Real super_y = lookup_l ()->text ("", "x", paper_l ()).extent
- ()[Y_AXIS].length () / 2;
- if (!name.addition_mol.empty_b ())
- name.addition_mol.translate (Offset (0, super_y));
-
- Molecule mol;
- mol.add_at_edge (X_AXIS, RIGHT, name.tonic_mol, 0);
- // huh?
- if (!name.modifier_mol.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, name.modifier_mol, 0);
- if (!name.addition_mol.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, name.addition_mol, 0);
- if (!name.inversion_mol.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, name.inversion_mol, 0);
- if (!name.bass_mol.empty_b ())
- mol.add_at_edge (X_AXIS, RIGHT, name.bass_mol, 0);
-
- s = get_elt_property ("word-space");
- if (gh_number_p (s))
- mol.dim_.interval_a_[X_AXIS][RIGHT] += gh_scm2double (s)
- * staff_symbol_referencer (this).staff_space ();
-
- return mol;
-}