2 tie-formatting-problem.cc -- implement Tie_formatting_problem
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "tie-formatting-problem.hh"
12 #include "paper-column.hh"
14 #include "directional-element-interface.hh"
16 #include "libc-extension.hh"
18 #include "note-head.hh"
19 #include "rhythmic-head.hh"
21 #include "staff-symbol-referencer.hh"
23 #include "tie-configuration.hh"
29 Tie_formatting_problem::print_ties_configuration (Ties_configuration const *ties)
31 for (vsize i = 0; i < ties->size (); i++)
33 char const *man_pos = (specifications_[i].has_manual_position_) ? "(M)" : "";
34 char const *man_dir = (specifications_[i].has_manual_dir_) ? "(M)" : "";
35 char const *dir = (ties->at (i).dir_ == UP) ? "up" : "dn";
37 printf ("(P%d%s, %s%s) ", ties->at (i).position_, man_pos, dir, man_dir);
43 Tie_formatting_problem::get_attachment (Real y) const
49 attachments[d] = skyline_height (chord_outlines_[d], y, -d);
51 while (flip (&d) != LEFT);
56 Tie_formatting_problem::Tie_formatting_problem()
61 Tie_formatting_problem::~Tie_formatting_problem ()
63 for (Tie_configuration_map::const_iterator i (possibilities_.begin ());
64 i != possibilities_.end (); i++)
69 Tie_formatting_problem::set_chord_outline (vector<Item*> bounds,
72 Real staff_space = Staff_symbol_referencer::staff_space (bounds[0]);
75 vector<Box> head_boxes;
78 for (vsize i = 0; i < bounds.size (); i++)
80 Grob *head = bounds[i];
81 if (!Note_head::has_interface (head))
85 stem = unsmob_grob (head->get_object ("stem"));
87 Real p = Staff_symbol_referencer::get_position (head);
88 Interval y ((p-1) * 0.5 * staff_space,
89 (p+1) * 0.5 * staff_space);
91 Interval x = head->extent (x_refpoint_, X_AXIS);
92 head_boxes.push_back (Box (x, y));
93 boxes.push_back (Box (x, y));
95 Grob *dots = Rhythmic_head::get_dots (head);
96 if (dir == LEFT && dots)
98 Interval x = dots->extent (x_refpoint_, X_AXIS);
99 int p = int (Staff_symbol_referencer::get_position (dots));
101 dot_positions_.insert (p);
104 Interval y (dots->extent (dots, Y_AXIS));
105 y.translate (p * staff_space * 0.5);
107 boxes.push_back (Box (x, y));
111 chord_outlines_[dir] = empty_skyline (-dir);
112 if (bounds[0]->break_status_dir ())
114 Real x = robust_relative_extent (bounds[0], x_refpoint_, X_AXIS)[-dir];
115 chord_outlines_[dir].at (0).height_ = x;
120 for (vsize i = 0; i < head_boxes.size (); i++)
122 x.unite (head_boxes[i][X_AXIS]);
125 chord_outlines_[dir].at (0).height_ = x[dir];
128 for (vsize i = 0; i < boxes.size (); i++)
129 insert_extent_into_skyline (&chord_outlines_[dir] ,
130 boxes[i], Y_AXIS, -dir);
133 && !Stem::is_invisible (stem))
136 x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
137 x.widen (staff_space / 20); // ugh.
139 y.add_point (Stem::stem_end_position (stem) * staff_space * .5);
141 Direction stemdir = get_grob_direction (stem);
142 y.add_point (Stem::head_positions (stem)[-stemdir]
145 insert_extent_into_skyline (&chord_outlines_[dir], Box (x,y), Y_AXIS, -dir);
147 stem_extents_[dir].unite (Box (x,y));
151 Box flag_box = Stem::get_translated_flag (stem).extent_box ();
152 flag_box.translate( Offset (x[RIGHT], X_AXIS));
153 insert_extent_into_skyline (&chord_outlines_[dir], flag_box,
158 Direction updowndir = DOWN;
163 if (head_boxes.size())
165 Box b = boundary (head_boxes, updowndir, 0);
167 x[-dir] = b[X_AXIS].linear_combination (-dir / 2);
168 y[-updowndir] = b[Y_AXIS][updowndir];
169 y[updowndir] = updowndir * infinity_f;
173 insert_extent_into_skyline (&chord_outlines_[dir],
177 while (flip (&updowndir) != DOWN);
179 head_extents_[dir].set_empty ();
180 for (vsize i = 0; i < head_boxes.size (); i++)
182 head_extents_[dir].unite (head_boxes[i]);
188 Tie_formatting_problem::from_tie (Grob *tie)
191 ties.push_back (tie);
194 details_.from_grob (tie);
198 Tie_formatting_problem::common_x_refpoint () const
204 Tie_formatting_problem::from_ties (vector<Grob*> const &ties)
209 x_refpoint_ = ties[0];
210 for (vsize i = 0; i < ties.size (); i++)
212 x_refpoint_ = dynamic_cast<Spanner*> (ties[i])->get_bound (LEFT)->common_refpoint (x_refpoint_, X_AXIS);
213 x_refpoint_ = dynamic_cast<Spanner*> (ties[i])->get_bound (RIGHT)->common_refpoint (x_refpoint_, X_AXIS);
216 details_.from_grob (ties[0]);
221 vector<Item*> bounds;
223 for (vsize i = 0; i < ties.size (); i++)
225 Item *it = dynamic_cast<Spanner*> (ties[i])->get_bound (d);
227 bounds.push_back (it);
230 set_chord_outline (bounds, d);
232 while (flip (&d) != LEFT);
235 for (vsize i = 0; i < ties.size (); i++)
237 Tie_specification spec;
239 if (scm_is_number (ties[i]->get_property_data (ly_symbol2scm ("direction"))))
241 spec.manual_dir_ = to_dir (ties[i]->get_property ("direction"));
242 spec.has_manual_dir_ = true;
245 spec.position_ = Tie::get_position (ties[i]);
246 if (scm_is_number (ties[i]->get_property ("staff-position")))
248 spec.manual_position_ = scm_to_double (ties[i]->get_property ("staff-position"));
249 spec.has_manual_position_ = true;
250 spec.position_ = int (my_round (spec.manual_position_));
255 spec.note_head_drul_[d] = Tie::head (ties[i], d);
256 spec.column_ranks_[d] =
257 dynamic_cast<Spanner*> (ties[i])->get_bound (d)->get_column ()->get_rank ();
259 while (flip (&d) != LEFT);
260 specifications_.push_back (spec);
265 Tie_formatting_problem::from_semi_ties (vector<Grob*> const &lv_ties, Direction head_dir)
267 if (lv_ties.empty ())
270 details_.from_grob (lv_ties[0]);
273 for (vsize i = 0; i < lv_ties.size (); i++)
275 Tie_specification spec;
276 Item *head = unsmob_item (lv_ties[i]->get_object ("note-head"));
279 programming_error ("LV tie without head?!");
283 spec.position_ = int (Staff_symbol_referencer::get_position (head));
286 spec.note_head_drul_[head_dir] = head;
287 heads.push_back (head);
288 specifications_.push_back (spec);
291 x_refpoint_ = lv_ties [0];
292 for (vsize i = 0; i < lv_ties.size (); i++)
293 x_refpoint_ = lv_ties[i]->common_refpoint (x_refpoint_, X_AXIS);
294 for (vsize i = 0; i < heads.size (); i++)
295 x_refpoint_ = heads[i]->common_refpoint (x_refpoint_, X_AXIS);
297 set_chord_outline (heads, head_dir);
299 Real extremal = head_dir * infinity_f;
301 for (vsize i = 0; i < chord_outlines_[head_dir].size (); i++)
303 extremal = head_dir * min (head_dir * extremal,
304 head_dir * chord_outlines_[head_dir][i].height_);
307 Skyline_entry right_entry;
308 right_entry.width_.set_full ();
309 right_entry.height_ = extremal - head_dir * 1.5;
311 chord_outlines_[-head_dir].push_back (right_entry);
316 Tie_formatting_problem::get_tie_specification (int i) const
318 return specifications_[i];
323 Return configuration, create it if necessary.
326 Tie_formatting_problem::get_configuration (int pos, Direction dir, Drul_array<int> columns) const
328 int key_components[] = {
329 pos, dir, columns[LEFT], columns[RIGHT]
331 Tuple<int,4> key (key_components);
333 Tie_configuration_map::const_iterator f = possibilities_.find (key);
334 if (f != possibilities_.end ())
340 Tie_configuration *conf = generate_configuration (pos, dir, columns);
341 ((Tie_formatting_problem*) this)->possibilities_[key] = conf;
346 Tie_formatting_problem::generate_configuration (int pos, Direction dir,
347 Drul_array<int> columns) const
349 Tie_configuration *conf = new Tie_configuration;
350 conf->position_ = pos;
353 conf->column_ranks_ = columns;
355 Real y = conf->position_ * 0.5 * details_.staff_space_;
358 if (dot_positions_.find (pos) != dot_positions_.end ())
360 conf->delta_y_ += dir * 0.25 * details_.staff_space_;
367 && max (fabs (head_extents_[LEFT][Y_AXIS][dir] - y),
368 fabs (head_extents_[RIGHT][Y_AXIS][dir] - y)) < 0.25
369 && !Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos))
372 (head_extents_[LEFT][Y_AXIS][dir] - y)
373 + dir * details_.outer_tie_vertical_gap_;
378 conf->attachment_x_ = get_attachment (y + conf->delta_y_);
379 Real h = conf->height (details_);
384 - should make sliding criterion, should flatten ties if
386 - they're just the wrong (ie. touching line at top & bottom)
390 if (h < details_.intra_space_threshold_ * 0.5 * details_.staff_space_)
392 if (!Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)
393 && abs (pos) < 2 * Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_))
395 conf->center_tie_vertically (details_);
397 else if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos))
399 conf->delta_y_ += dir *
400 details_.tip_staff_line_clearance_ * 0.5 * details_.staff_space_;
405 Real top_y = y + conf->delta_y_ + conf->dir_ * h;
406 Real top_pos = top_y / (0.5*details_.staff_space_);
407 int round_pos = int (my_round (top_pos));
409 /* TODO: should use other variable? */
410 Real clearance = details_.center_staff_line_clearance_;
411 if (fabs (top_pos - round_pos) < clearance
412 && Staff_symbol_referencer::on_staff_line (details_.staff_symbol_referencer_,
415 Real new_y = (round_pos + clearance * conf->dir_) * 0.5 * details_.staff_space_;
416 conf->delta_y_ = (new_y - top_y);
421 conf->attachment_x_ = get_attachment (y + conf->delta_y_);
422 if (conf->height (details_) < details_.intra_space_threshold_ * 0.5 * details_.staff_space_)
425 This is less sensible for long ties, since those are more
428 Interval close_by = get_attachment (y
430 + (dir * details_.intra_space_threshold_ * 0.25
431 * details_.staff_space_));
433 conf->attachment_x_.intersect (close_by);
436 conf->attachment_x_.widen ( - details_.x_gap_);
441 Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_;
442 if (stem_extents_[d][X_AXIS].is_empty ()
443 || !stem_extents_[d][Y_AXIS].contains (y))
446 conf->attachment_x_[d] =
447 d* min (d * conf->attachment_x_[d],
448 d * (stem_extents_[d][X_AXIS][-d] - d * details_.stem_gap_));
450 while (flip (&d) != LEFT);
455 TIE_IDX and TIES_CONF are optional.
458 Tie_formatting_problem::score_aptitude (Tie_configuration *conf,
459 Tie_specification const &spec,
460 Ties_configuration *ties_conf, int tie_idx) const
463 Real curve_y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_;
464 Real tie_y = spec.position_ * details_.staff_space_ * 0.5;
465 if (sign (curve_y - tie_y) != conf->dir_)
467 Real p = details_.wrong_direction_offset_penalty_;
469 ties_conf->add_tie_score (p, tie_idx, "wrong dir");
475 Real p = details_.vertical_distance_penalty_factor_ * fabs (curve_y - tie_y);
477 ties_conf->add_tie_score (p, tie_idx, "vdist");
485 if (!spec.note_head_drul_[d])
488 Interval head_x = spec.note_head_drul_[d]->extent (x_refpoint_, X_AXIS);
489 Real dist = head_x.distance (conf->attachment_x_[d]);
492 TODO: flatten with log or sqrt.
494 Real p = details_.horizontal_distance_penalty_factor_ * dist;
496 ties_conf->add_tie_score (p, tie_idx,
497 (d == LEFT) ? "lhdist" : "rhdist");
501 while (flip (&d) != LEFT);
507 Tie_formatting_problem::score_configuration (Tie_configuration *conf) const
514 Real length = conf->attachment_x_.length ();
516 conf->add_score (details_.min_length_penalty_factor_
517 * peak_around (0.33 * details_.min_length_, details_.min_length_, length),
520 Real tip_pos = conf->position_ + conf->delta_y_ / 0.5 * details_.staff_space_;
521 Real tip_y = tip_pos * details_.staff_space_ * 0.5;
522 Real height = conf->height (details_);
524 Real top_y = tip_y + conf->dir_ * height;
525 Real top_pos = 2 * top_y / details_.staff_space_;
526 Real round_top_pos = rint (top_pos);
527 if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_,
529 && Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_) > top_y)
532 details_.staff_line_collision_penalty_
533 * peak_around (0.1 * details_.center_staff_line_clearance_,
534 details_.center_staff_line_clearance_,
535 fabs (top_pos - round_top_pos)),
539 if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_,
540 int (rint (tip_pos))))
542 conf->add_score (details_.staff_line_collision_penalty_
543 * peak_around (0.1 * details_.tip_staff_line_clearance_,
544 details_.tip_staff_line_clearance_,
545 fabs (tip_pos - rint (tip_pos))),
549 if (!dot_x_.is_empty ())
552 Real x = dot_x_.center ();
554 Bezier b = conf->get_transformed_bezier (details_);
555 if (b.control_point_extent (X_AXIS).contains (x))
557 Real y = b.get_other_coordinate (X_AXIS, x);
559 for (set<int>::const_iterator i (dot_positions_.begin ());
560 i != dot_positions_.end (); i ++)
563 conf->add_score (details_.dot_collision_penalty_
564 * peak_around (.1 * details_.dot_collision_clearance_,
565 details_.dot_collision_clearance_,
566 fabs (dot_pos * details_.staff_space_ * 0.5 - y)),
572 conf->scored_ = true;
576 Tie_formatting_problem::find_optimal_tie_configuration (Tie_specification const &spec) const
578 vector<Tie_configuration*> confs;
580 int pos = spec.position_;
581 Direction dir = spec.manual_dir_;
583 for (int i = 0; i < details_.single_tie_region_size_; i ++)
585 confs.push_back (generate_configuration (pos + i * dir, dir,
586 spec.column_ranks_));
588 if (spec.has_manual_position_)
590 confs.back ()->delta_y_
591 = (spec.manual_position_ - spec.position_)
592 * 0.5 * details_.staff_space_;
601 Real best_score = 1e6;
602 for (vsize i = 0; i < confs.size (); i ++)
604 score_configuration (confs[i]);
605 Real score = score_aptitude (confs[i], spec, 0, 0)
606 + confs[i]->score ();
608 if (score < best_score)
615 Tie_configuration best = *confs[best_idx];
616 for (vsize i = 0; i < confs.size (); i++)
622 Tie_specification::Tie_specification ()
624 has_manual_position_ = false;
625 has_manual_dir_ = false;
627 manual_position_ = 0;
628 manual_dir_ = CENTER;
629 note_head_drul_[LEFT] =
630 note_head_drul_[RIGHT] = 0;
631 column_ranks_[RIGHT] =
632 column_ranks_[LEFT] = 0;
636 Tie_specification::column_span () const
638 return column_ranks_[RIGHT] - column_ranks_[LEFT];
642 Tie_formatting_problem::score_ties_aptitude (Ties_configuration *ties) const
644 if (ties->size () != specifications_.size ())
646 programming_error ("Huh? Mismatch between sizes.");
650 for (vsize i = 0; i < ties->size (); i++)
651 score_aptitude (&ties->at (i), specifications_[i],
656 Tie_formatting_problem::score_ties (Ties_configuration *ties) const
661 score_ties_configuration (ties);
662 score_ties_aptitude (ties);
663 ties->scored_ = true;
667 Tie_formatting_problem::score_ties_configuration (Ties_configuration *ties) const
669 for (vsize i = 0; i < ties->size (); i++)
671 score_configuration (&ties->at (i));
672 ties->add_tie_score (ties->at (i).score (), i, "conf");
675 Real last_edge = 0.0;
676 Real last_center = 0.0;
677 for (vsize i = 0; i < ties->size (); i++)
679 Bezier b (ties->at (i).get_transformed_bezier (details_));
681 Real center = b.curve_point (0.5)[Y_AXIS];
682 Real edge = b.curve_point (0.0)[Y_AXIS];
686 if (edge <= last_edge)
687 ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton edge");
688 if (center <= last_center)
689 ties->add_score (details_.tie_column_monotonicity_penalty_, "monoton cent");
691 ties->add_score (details_.tie_tie_collision_penalty_ *
692 peak_around (0.1 * details_.tie_tie_collision_distance_,
693 details_.tie_tie_collision_distance_,
694 fabs (center - last_center)),
696 ties->add_score (details_.tie_tie_collision_penalty_ *
697 peak_around (0.1 * details_.tie_tie_collision_distance_,
698 details_.tie_tie_collision_distance_,
699 fabs (edge - last_edge)), "tietie edge");
703 last_center = center;
706 ties->add_score (details_.outer_tie_length_symmetry_penalty_factor_
707 * fabs (ties->at (0).attachment_x_.length () - ties->back ().attachment_x_.length ()),
710 ties->add_score (details_.outer_tie_vertical_distance_symmetry_penalty_factor_
711 * fabs (fabs (specifications_[0].position_ * 0.5 * details_.staff_space_
712 - (ties->at (0).position_ * 0.5 * details_.staff_space_
713 + ties->at (0).delta_y_))
715 fabs (specifications_.back ().position_ * 0.5 * details_.staff_space_
716 - (ties->back ().position_ * 0.5 * details_.staff_space_
717 + ties->back ().delta_y_))),
722 Generate with correct X-attachments and beziers, copying delta_y_
723 from TIES_CONFIG if necessary.
726 Tie_formatting_problem::generate_ties_configuration (Ties_configuration const &ties_config)
728 Ties_configuration copy;
729 for (vsize i = 0; i < ties_config.size (); i++)
731 Tie_configuration * ptr = get_configuration (ties_config[i].position_, ties_config[i].dir_,
732 ties_config[i].column_ranks_);
733 if (specifications_[i].has_manual_position_)
736 = (specifications_[i].manual_position_ - ties_config[i].position_)
737 * 0.5 * details_.staff_space_;
739 copy.push_back (*ptr);
746 Tie_formatting_problem::generate_base_chord_configuration ()
748 Ties_configuration ties_config;
749 for (vsize i = 0; i < specifications_.size (); i ++)
751 Tie_configuration conf;
752 if (specifications_[i].has_manual_dir_)
753 conf.dir_ = specifications_[i].manual_dir_;
754 if (specifications_[i].has_manual_position_)
756 conf.position_ = (int) my_round (specifications_[i].manual_position_);
757 conf.delta_y_ = (specifications_[i].manual_position_ - conf.position_)
758 * 0.5 * details_.staff_space_;
762 conf.position_ = specifications_[i].position_;
764 ties_config.push_back (conf);
767 set_ties_config_standard_directions (&ties_config);
768 for (vsize i = 0; i < ties_config.size (); i++)
769 if (!specifications_[i].manual_position_)
770 ties_config[i].position_ += ties_config[i].dir_;
772 ties_config = generate_ties_configuration (ties_config);
778 Tie_formatting_problem::find_best_variation (Ties_configuration const &base,
779 vector<Tie_configuration_variation> vars)
781 Ties_configuration best = base;
784 This simply is 1-opt: we have K substitions, and we try applying
785 exactly every one for each.
787 for (vsize i = 0; i < vars.size (); i++)
789 Ties_configuration variant (base);
790 variant[vars[i].index_] = *vars[i].suggestion_;
792 variant.reset_score ();
793 score_ties (&variant);
795 if (variant.score () < best.score ())
807 Tie_formatting_problem::generate_optimal_chord_configuration ()
810 Ties_configuration base = generate_base_chord_configuration ();
811 vector<Tie_configuration_variation> vars = generate_collision_variations (base);
814 Ties_configuration best = find_best_variation (base, vars);
815 vars = generate_extremal_tie_variations (best);
816 best = find_best_variation (best, vars);
822 Tie_formatting_problem::set_ties_config_standard_directions (Ties_configuration *tie_configs)
824 if (tie_configs->empty ())
827 if (!tie_configs->at (0).dir_)
828 tie_configs->at (0).dir_ = DOWN;
829 if (!tie_configs->back ().dir_)
830 tie_configs->back ().dir_ = UP;
835 for (vsize i = 1; i < tie_configs->size (); i++)
837 Real diff = (tie_configs->at (i).position_
838 -tie_configs->at (i-1).position_);
841 = specifications_[i].column_span () - specifications_[i-1].column_span ();
842 if (span_diff && fabs (diff) <= 2)
845 tie_configs->at (i).dir_ = UP;
846 else if (span_diff < 0)
847 tie_configs->at (i-1).dir_ = DOWN;
849 else if (fabs (diff) <= 1)
851 if (!tie_configs->at (i-1).dir_)
852 tie_configs->at (i-1).dir_ = DOWN;
853 if (!tie_configs->at (i).dir_)
854 tie_configs->at (i).dir_ = UP;
858 for (vsize i = 1; i < tie_configs->size() - 1; i++)
860 Tie_configuration &conf = tie_configs->at (i);
864 Direction position_dir =
865 Direction (sign (conf.position_));
869 conf.dir_ = position_dir;
873 Tie_configuration_variation::Tie_configuration_variation ()
879 vector<Tie_configuration_variation>
880 Tie_formatting_problem::generate_extremal_tie_variations (Ties_configuration const &ties) const
882 vector<Tie_configuration_variation> vars;
886 if (boundary (ties, d, 0).dir_ == d
887 && !boundary (specifications_, d, 0).has_manual_position_)
888 for (int i = 1; i <= details_.multi_tie_region_size_; i++)
890 Tie_configuration_variation var;
891 var.index_ = (d == DOWN) ? 0 : ties.size () - 1;
892 var.suggestion_ = get_configuration (boundary (ties, d, 0).position_
894 boundary (ties, d, 0).column_ranks_);
895 vars.push_back (var);
898 while (flip (&d) != DOWN);
904 vector<Tie_configuration_variation>
905 Tie_formatting_problem::generate_collision_variations (Ties_configuration const &ties) const
907 Real center_distance_tolerance = 0.25;
909 vector<Tie_configuration_variation> vars;
910 Real last_center = 0.0;
911 for (vsize i = 0; i < ties.size (); i++)
913 Bezier b (ties[i].get_transformed_bezier (details_));
915 Real center = b.curve_point (0.5)[Y_AXIS];
919 if (center <= last_center + center_distance_tolerance)
921 if (!specifications_[i].has_manual_dir_)
923 Tie_configuration_variation var;
925 var.suggestion_ = get_configuration (specifications_[i].position_
929 ties[i].column_ranks_
932 vars.push_back (var);
935 if (!specifications_[i-1].has_manual_dir_)
937 Tie_configuration_variation var;
939 var.suggestion_ = get_configuration (specifications_[i-1].position_
942 specifications_[i-1].column_ranks_);
944 vars.push_back (var);
947 if (i == 1 && !specifications_[i-1].has_manual_position_
948 && ties[i-1].dir_ == DOWN)
950 Tie_configuration_variation var;
952 var.suggestion_ = get_configuration (specifications_[i-1].position_ - 1, DOWN,
953 specifications_[i-1].column_ranks_);
954 vars.push_back (var);
956 if (i == ties.size() && !specifications_[i].has_manual_position_
957 && ties[i].dir_ == UP)
959 Tie_configuration_variation var;
961 var.suggestion_ = get_configuration (specifications_[i].position_
963 specifications_[i].column_ranks_);
964 vars.push_back (var);
967 else if (dot_positions_.find (ties[i].position_) != dot_positions_.end ()
968 && !specifications_[i].has_manual_position_)
970 Tie_configuration_variation var;
972 var.suggestion_ = get_configuration (ties[i].position_ + ties[i].dir_,
974 ties[i].column_ranks_);
975 vars.push_back (var);
980 last_center = center;
988 Tie_formatting_problem::set_manual_tie_configuration (SCM manual_configs)
991 for (SCM s = manual_configs;
992 scm_is_pair (s) && k < specifications_.size (); s = scm_cdr (s))
994 SCM entry = scm_car (s);
995 if (scm_is_pair (entry))
997 Tie_specification &spec = specifications_[k];
999 if (scm_is_number (scm_car (entry)))
1001 spec.has_manual_position_ = true;
1002 spec.manual_position_ = scm_to_double (scm_car (entry));
1004 if (scm_is_number (scm_cdr (entry)))
1006 spec.has_manual_dir_ = true;
1007 spec.manual_dir_ = Direction (scm_to_int (scm_cdr (entry)));