- Molecule* mol_p = new Molecule;
-
- if (column_arr_.size ()){
- Real ncw = column_arr_.top ()->extent (X_AXIS).length ();
- Atom num (tdef_p_->get_atom (paper (), CENTER));
-
- if (beam_l_ && !bracket_visibility_b_)
- {
- num.translate (((Directional_spanner*)beam_l_)->center ());
- num.translate_axis (ncw, X_AXIS);
- }
-
- if (bracket_visibility_b_)
- {
- Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_]
- - column_arr_[0]->extent (Y_AXIS) [dir_];
- Real w = width ().length () + ncw;
-
- num.translate (Offset (w/2, dy/2));
- mol_p->add_atom (lookup_l ()->plet (dy, w, dir_));
- }
-
- if (num_visibility_b_)
- mol_p->add_atom (num);
- }
- return mol_p;
+ Molecule mol;
+
+ // Default behaviour: number always, bracket when no beam!
+ bool par_beam = to_boolean (get_elt_property ("parallel-beam"));
+ bool bracket_visibility = !par_beam;
+ bool number_visibility = true;
+
+ SCM bracket = get_elt_property ("tuplet-bracket-visibility");
+ if (gh_boolean_p (bracket))
+ {
+ bracket_visibility = gh_scm2bool (bracket);
+ }
+ else if (bracket == ly_symbol2scm ("if-no-beam"))
+ bracket_visibility = !par_beam;
+
+ SCM numb = get_elt_property ("tuplet-number-visibility");
+ if (gh_boolean_p (numb))
+ {
+ number_visibility = gh_scm2bool (numb);
+ }
+ else if (bracket == ly_symbol2scm ("if-no-beam"))
+ number_visibility = !par_beam;
+
+ if (gh_pair_p (get_elt_pointer ("columns")))
+ {
+ Link_array<Note_column> column_arr=
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns");
+
+ Real ncw = column_arr.top ()->extent(X_AXIS).length ();
+ Real w = spanner_length () + ncw;
+
+
+ Real staff_space = paper_l ()->get_var ("interline");
+ Direction dir = directional_element (this).get ();
+ Real dy = gh_scm2double (get_elt_property ("delta-y"));
+ SCM number = get_elt_property ("text");
+ if (gh_string_p (number) && number_visibility)
+ {
+ Molecule
+ num (lookup_l ()->text ("italic",
+ ly_scm2string (number), paper_l ()));
+ num.align_to (X_AXIS, CENTER);
+ num.translate_axis (w/2, X_AXIS);
+ num.align_to (Y_AXIS, CENTER);
+ num.translate_axis (dir * staff_space, Y_AXIS);
+
+ num.translate_axis (dy/2, Y_AXIS);
+
+ mol.add_molecule (num);
+ }
+
+ if (bracket_visibility)
+ {
+ SCM ss = paper_l ()->get_scmvar ("staffspace");
+ SCM lt = paper_l ()->get_scmvar ("stafflinethickness");
+
+ SCM thick = get_elt_property ("thick");
+ SCM gap = get_elt_property ("number-gap");
+
+ SCM at =gh_list(ly_symbol2scm ("tuplet"),
+ ss,
+ scm_product (gap, ss),
+ gh_double2scm (w),
+ gh_double2scm (dy),
+ scm_product (thick, lt),
+ gh_int2scm (dir),
+ SCM_UNDEFINED);
+
+ Box b;
+ mol.add_molecule (Molecule (b, at));
+ }
+ }
+ return mol;