From 674944a79e5ced59eb0992313623d6fa16ea626d Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 1 Nov 2006 00:12:21 +0000 Subject: [PATCH] only prepend header if one patch was successful. use position/direction from single tie case too. This fixes overridesand defaults for single laissez-vibrer and repeat ties. --- ChangeLog | 13 ++++ buildscripts/git-update-changelog.py | 3 +- input/regression/tie-semi-single.ly | 30 ++++++++ lily/include/tie-configuration.hh | 1 + lily/include/tie-formatting-problem.hh | 1 + lily/semi-tie.cc | 20 +----- lily/tie-configuration.cc | 6 ++ lily/tie-formatting-problem.cc | 98 ++++++++++++++++---------- lily/tie.cc | 13 +++- scm/define-grobs.scm | 8 ++- 10 files changed, 135 insertions(+), 58 deletions(-) create mode 100644 input/regression/tie-semi-single.ly diff --git a/ChangeLog b/ChangeLog index 200b37b456..1bf00206b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-10-30 Han-Wen Nienhuys + + * input/regression/tie-semi-single.ly: + use position/direction from single tie case too. This fixes overridesand defaults for single laissez-vibrer and repeat ties. + + * buildscripts/git-update-changelog.py: + only prepend header if one patch was successful. + +2006-10-31 Jan Nieuwenhuizen + + * cygwin/GNUmakefile (#INSTALLATION_OUT_DIR): Remove postinstall + stuff. Remove cygwin packaging stuff. + 2006-10-30 Jan Nieuwenhuizen * python/convertrules.py (conv): Part 2 fixes vertical extent. diff --git a/buildscripts/git-update-changelog.py b/buildscripts/git-update-changelog.py index fb6e01a5ae..fba7c65f23 100644 --- a/buildscripts/git-update-changelog.py +++ b/buildscripts/git-update-changelog.py @@ -182,7 +182,8 @@ Run this file from the CVS directory, with --git-dir if op == 'add': system ('cvs add %(f)s' % locals ()) - new_log = header (last_commit) + new_log + '\n' + if last_commit: + new_log = header (last_commit) + new_log + '\n' log = new_log + log diff --git a/input/regression/tie-semi-single.ly b/input/regression/tie-semi-single.ly new file mode 100644 index 0000000000..ccd1c4a9e1 --- /dev/null +++ b/input/regression/tie-semi-single.ly @@ -0,0 +1,30 @@ + +\header { + + + texidoc = "Like normal ties, single semities (LaissezVibrerTie or +RepeatTie) get their direction from the stem direction, and may be +tweaked with @code{#'direction}." + + +} +\version "2.9.27" +\layout{ragged-right=##t} + +{ + r4 + c'\laissezVibrer\repeatTie + \stemUp + b'\laissezVibrer\repeatTie + r + + \stemDown + b'\laissezVibrer\repeatTie + r + c''\laissezVibrer\repeatTie + r + + \override LaissezVibrerTie #'direction = #DOWN + \override RepeatTie #'direction = #DOWN + c''\laissezVibrer_"override"\repeatTie +} diff --git a/lily/include/tie-configuration.hh b/lily/include/tie-configuration.hh index 0594de6eaf..cd3bfe3998 100644 --- a/lily/include/tie-configuration.hh +++ b/lily/include/tie-configuration.hh @@ -44,6 +44,7 @@ public: Bezier get_transformed_bezier (Tie_details const &) const; Bezier get_untransformed_bezier (Tie_details const &) const; Real height (Tie_details const&) const; + int column_span_length () const; static int compare (Tie_configuration const &a, Tie_configuration const &b); diff --git a/lily/include/tie-formatting-problem.hh b/lily/include/tie-formatting-problem.hh index 08b823fc83..5d46129fe5 100644 --- a/lily/include/tie-formatting-problem.hh +++ b/lily/include/tie-formatting-problem.hh @@ -37,6 +37,7 @@ struct Tie_specification Tie_specification (); int column_span () const; + void get_tie_manual_settings (Grob *); }; struct Tie_configuration_variation diff --git a/lily/semi-tie.cc b/lily/semi-tie.cc index 854dd0302e..c5a514b535 100644 --- a/lily/semi-tie.cc +++ b/lily/semi-tie.cc @@ -34,6 +34,8 @@ SCM Semi_tie::calc_control_points (SCM smob) { Grob *me = unsmob_grob (smob); + (void) me->get_property ("direction"); + if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS))) { me->get_parent (Y_AXIS)->get_property ("positioning-done"); @@ -47,24 +49,6 @@ Semi_tie::calc_control_points (SCM smob) return SCM_UNSPECIFIED; } -MAKE_SCHEME_CALLBACK(Semi_tie, calc_direction, 1) -SCM -Semi_tie::calc_direction (SCM smob) -{ - Grob *me = unsmob_grob (smob); - if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS))) - { - me->get_parent (Y_AXIS)->get_property("positioning-done"); - } - else - { - programming_error ("lv tie without Semi_tie_column"); - set_grob_direction (me, UP); - } - - return SCM_UNSPECIFIED; -} - int Semi_tie::get_position (Grob *me) { diff --git a/lily/tie-configuration.cc b/lily/tie-configuration.cc index 438d22e2c7..2e15eb72eb 100644 --- a/lily/tie-configuration.cc +++ b/lily/tie-configuration.cc @@ -74,6 +74,12 @@ Tie_configuration::get_untransformed_bezier (Tie_details const &details) const details.ratio_); } +int +Tie_configuration::column_span_length () const +{ + return column_ranks_[RIGHT] - column_ranks_[LEFT]; +} + Real Tie_configuration::distance (Tie_configuration const &a, Tie_configuration const &b) diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index 8adc406227..d22d54bb6a 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -288,20 +288,10 @@ Tie_formatting_problem::from_ties (vector const &ties) for (vsize i = 0; i < ties.size (); i++) { Tie_specification spec; + + spec.get_tie_manual_settings (ties[i]); - if (scm_is_number (ties[i]->get_property_data ("direction"))) - { - spec.manual_dir_ = to_dir (ties[i]->get_property ("direction")); - spec.has_manual_dir_ = true; - } - - spec.position_ = Tie::get_position (ties[i]); - if (scm_is_number (ties[i]->get_property ("staff-position"))) - { - spec.manual_position_ = scm_to_double (ties[i]->get_property ("staff-position")); - spec.has_manual_position_ = true; - spec.position_ = int (my_round (spec.manual_position_)); - } + do { @@ -315,19 +305,19 @@ Tie_formatting_problem::from_ties (vector const &ties) } void -Tie_formatting_problem::from_semi_ties (vector const &lv_ties, Direction head_dir) +Tie_formatting_problem::from_semi_ties (vector const &semi_ties, Direction head_dir) { - if (lv_ties.empty ()) + if (semi_ties.empty ()) return; - details_.from_grob (lv_ties[0]); + details_.from_grob (semi_ties[0]); vector heads; int column_rank = -1; - for (vsize i = 0; i < lv_ties.size (); i++) + for (vsize i = 0; i < semi_ties.size (); i++) { Tie_specification spec; - Item *head = unsmob_item (lv_ties[i]->get_object ("note-head")); + Item *head = unsmob_item (semi_ties[i]->get_object ("note-head")); if (!head) programming_error ("LV tie without head?!"); @@ -336,8 +326,9 @@ Tie_formatting_problem::from_semi_ties (vector const &lv_ties, Direction { spec.position_ = int (Staff_symbol_referencer::get_position (head)); } - + spec.get_tie_manual_settings (semi_ties[i]); + spec.note_head_drul_[head_dir] = head; column_rank = dynamic_cast (head)->get_column ()->get_rank (); spec.column_ranks_ = Drul_array (column_rank, column_rank); @@ -345,9 +336,9 @@ Tie_formatting_problem::from_semi_ties (vector const &lv_ties, Direction specifications_.push_back (spec); } - x_refpoint_ = lv_ties [0]; - for (vsize i = 0; i < lv_ties.size (); i++) - x_refpoint_ = lv_ties[i]->common_refpoint (x_refpoint_, X_AXIS); + x_refpoint_ = semi_ties [0]; + for (vsize i = 0; i < semi_ties.size (); i++) + x_refpoint_ = semi_ties[i]->common_refpoint (x_refpoint_, X_AXIS); for (vsize i = 0; i < heads.size (); i++) x_refpoint_ = heads[i]->common_refpoint (x_refpoint_, X_AXIS); @@ -494,20 +485,29 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir, conf->attachment_x_.widen ( - details_.x_gap_); - Direction d = LEFT; - do + if (conf->column_span_length ()) { - Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_; - if (get_stem_extent (conf->column_ranks_[d], d, X_AXIS).is_empty () - || !get_stem_extent (conf->column_ranks_[d], d, Y_AXIS).contains (y)) - continue; + /* + avoid the stems that we attach to as well. We don't do this + for semities (span length = 0) - conf->attachment_x_[d] = - d * min (d * conf->attachment_x_[d], - d * (get_stem_extent (conf->column_ranks_[d], d, X_AXIS)[-d] - d * details_.stem_gap_)); - } - while (flip (&d) != LEFT); - + It would be better to check D against HEAD-DIRECTION if + applicable. + */ + Direction d = LEFT; + do + { + Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_; + if (get_stem_extent (conf->column_ranks_[d], d, X_AXIS).is_empty () + || !get_stem_extent (conf->column_ranks_[d], d, Y_AXIS).contains (y)) + continue; + + conf->attachment_x_[d] = + d * min (d * conf->attachment_x_[d], + d * (get_stem_extent (conf->column_ranks_[d], d, X_AXIS)[-d] - d * details_.stem_gap_)); + } + while (flip (&d) != LEFT); + } return conf; } @@ -709,6 +709,25 @@ Tie_specification::Tie_specification () column_ranks_[LEFT] = 0; } + +void +Tie_specification::get_tie_manual_settings (Grob *tie) +{ + if (scm_is_number (tie->get_property_data ("direction"))) + { + manual_dir_ = to_dir (tie->get_property ("direction")); + has_manual_dir_ = true; + } + + position_ = Tie::get_position (tie); + if (scm_is_number (tie->get_property ("staff-position"))) + { + manual_position_ = scm_to_double (tie->get_property ("staff-position")); + has_manual_position_ = true; + position_ = int (my_round (manual_position_)); + } +} + int Tie_specification::column_span () const { @@ -901,9 +920,16 @@ Tie_formatting_problem::set_ties_config_standard_directions (Ties_configuration { if (tie_configs->empty ()) return ; - + if (!tie_configs->at (0).dir_) - tie_configs->at (0).dir_ = DOWN; + { + if (tie_configs->size () == 1) + tie_configs->at (0).dir_ = Direction (sign (tie_configs->at (0).position_)); + + if (!tie_configs->at (0).dir_) + tie_configs->at (0).dir_ = DOWN; + } + if (!tie_configs->back ().dir_) tie_configs->back ().dir_ = UP; diff --git a/lily/tie.cc b/lily/tie.cc index 2cad6b302f..264bc9172a 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -26,6 +26,7 @@ #include "tie-configuration.hh" #include "tie-formatting-problem.hh" #include "warn.hh" +#include "semi-tie-column.hh" bool @@ -44,6 +45,15 @@ Tie::set_head (Grob *me, Direction d, Grob *h) Grob * Tie::head (Grob *me, Direction d) { + if (is_direction (me->get_property ("head-direction"))) + { + Direction hd = to_dir (me->get_property ("head-direction")); + + return (hd == d) + ? unsmob_grob (me->get_object ("note-head")) + : 0; + } + Item *it = dynamic_cast (me)->get_bound (d); if (Note_head::has_interface (it)) return it; @@ -135,7 +145,8 @@ Tie::calc_direction (SCM smob) { Grob *me = unsmob_grob (smob); Grob *yparent = me->get_parent (Y_AXIS); - if (Tie_column::has_interface (yparent) + if ((Tie_column::has_interface (yparent) + || Semi_tie_column::has_interface (yparent)) && unsmob_grob_array (yparent->get_object ("ties")) && unsmob_grob_array (yparent->get_object ("ties"))->size () > 1) { diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 37277a762a..3ad6b22bff 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -803,9 +803,10 @@ . ( (stencil . ,ly:tie::print) (control-points . ,ly:semi-tie::calc-control-points) - (direction . ,ly:semi-tie::calc-direction) + (direction . ,ly:tie::calc-direction) (details . ((ratio . 0.333) (height-limit . 1.0))) + (head-direction . ,LEFT) (thickness . 1.0) (meta . ((class . Item) (interfaces . (semi-tie-interface)) @@ -1277,10 +1278,11 @@ . ( (stencil . ,ly:tie::print) (control-points . ,ly:semi-tie::calc-control-points) - (direction . ,ly:semi-tie::calc-direction) + (direction . ,ly:tie::calc-direction) (details . ((ratio . 0.333) (height-limit . 1.0))) (thickness . 1.0) + (head-direction . ,RIGHT) (meta . ((class . Item) (interfaces . (semi-tie-interface)) )) @@ -1290,7 +1292,9 @@ . ( (X-extent . #f) (Y-extent . #f) + (direction . ,ly:tie::calc-direction) (head-direction . ,RIGHT) + (positioning-done . ,ly:semi-tie-column::calc-positioning-done) (meta . ((class . Item) (interfaces . (semi-tie-column-interface)) -- 2.39.5