From: Han-Wen Nienhuys Date: Mon, 9 Oct 2006 11:47:39 +0000 (+0000) Subject: * scm/define-grobs.scm (all-grob-descriptions): set X-Git-Tag: release/2.10.0-2~214 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f354ae4e1a6dab6ad4b1a98c2d732f542a05a02e;p=lilypond.git * scm/define-grobs.scm (all-grob-descriptions): set allow-loose-spacing for PaperColumn and NonMusicalPaperColumn. * lily/spaceable-grob.cc: add allow-loose-spacing property. * lily/spacing-determine-loose-columns.cc (is_loose_column): allow-loose-spacing property. --- diff --git a/ChangeLog b/ChangeLog index 6aa8986c7a..0a1fdbe851 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-10-09 Han-Wen Nienhuys + * scm/define-grobs.scm (all-grob-descriptions): set + allow-loose-spacing for PaperColumn and NonMusicalPaperColumn. + + * lily/spaceable-grob.cc: add allow-loose-spacing property. + + * lily/spacing-determine-loose-columns.cc (is_loose_column): + allow-loose-spacing property. + * scm/define-markup-commands.scm (postscript): gsave & grestore around embedded PS. Do setlinewidth too. Fixes #109. diff --git a/lily/spaceable-grob.cc b/lily/spaceable-grob.cc index 96313acf4a..0f3dc9849b 100644 --- a/lily/spaceable-grob.cc +++ b/lily/spaceable-grob.cc @@ -122,7 +122,10 @@ Spaceable_grob::remove_interface (Grob *me) ADD_INTERFACE (Spaceable_grob, "spaceable-grob-interface", "A layout object that takes part in the spacing problem. ", + + /* properties */ + "allow-loose-spacing " "ideal-distances " "keep-inside-line " "left-neighbors " diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 93f70b5cec..8cd0b9b6a0 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -30,19 +30,22 @@ (Otherwise, we might risk core dumps, and other weird stuff.) */ static bool -is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options) +is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) { + if (!to_boolean (col->get_property ("allow-loose-spacing"))) + return false; + if ((options->float_nonmusical_columns_ ||options->float_grace_columns_) - && Paper_column::when_mom (c).grace_part_) + && Paper_column::when_mom (col).grace_part_) return true; - if (Paper_column::is_musical (c) - || Paper_column::is_breakable (c)) + if (Paper_column::is_musical (col) + || Paper_column::is_breakable (col)) return false; - extract_grob_set (c, "right-neighbors", rns); - extract_grob_set (c, "left-neighbors", lns); + extract_grob_set (col, "right-neighbors", rns); + extract_grob_set (col, "left-neighbors", lns); /* If this column doesn't have a proper neighbor, we should really @@ -98,7 +101,7 @@ is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options) in any case, we don't want to move bar lines. */ - extract_grob_set (c, "elements", elts); + extract_grob_set (col, "elements", elts); for (vsize i = elts.size (); i--;) { Grob *g = elts[i]; @@ -159,15 +162,13 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector *cols, /* Set distance constraints for loose columns */ - Drul_array next_door; - next_door[LEFT] = cols->at (i - 1); - next_door[RIGHT] = cols->at (i + 1); + Drul_array next_door (cols->at (i - 1), + cols->at (i + 1)); Direction d = LEFT; Drul_array dists (0, 0); do { - dists[d] = 0.0; Item *lc = dynamic_cast ((d == LEFT) ? next_door[LEFT] : c); Item *rc = dynamic_cast (d == LEFT ? c : next_door[RIGHT]); @@ -179,19 +180,19 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector *cols, || Note_spacing::right_column (sp) != rc) continue; - Real space, fixed; - fixed = 0.0; - bool dummy; - if (Note_spacing::has_interface (sp)) { /* The note spacing should be taken from the musical columns. - */ + Real space = 0.0; + Real fixed = 0.0; + bool dummy = false; + Real base = note_spacing (me, lc, rc, options, &dummy); - Note_spacing::get_spacing (sp, rc, base, options->increment_, &space, &fixed); + Note_spacing::get_spacing (sp, rc, base, options->increment_, + &space, &fixed); space -= options->increment_; @@ -199,7 +200,8 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector *cols, } else if (Staff_spacing::has_interface (sp)) { - Real space, fixed_space; + Real space = 0; + Real fixed_space = 0; Staff_spacing::get_spacing_params (sp, &space, &fixed_space); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 7f46e9890b..c1c5f43ea2 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -33,6 +33,7 @@ relative to its Y-parent") (align-dir ,ly:dir? "Which side to align? @code{-1}: left side, @code{0}: around center of width, @code{1}: right side.") + (allow-loose-spacing ,boolean? "If set, column can be detached from main spacing.") (arpeggio-direction ,ly:dir? "If set, put an arrow on the arpeggio squiggly line.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index a82741dc69..f35f29d59c 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1117,6 +1117,7 @@ (PaperColumn . ( (axes . (0)) + (allow-loose-spacing . #t) (before-line-breaking . ,ly:paper-column::before-line-breaking) ;; (stencil . ,ly:paper-column::print) (X-extent . ,ly:axis-group-interface::width) @@ -1152,6 +1153,7 @@ (NonMusicalPaperColumn . ( + (allow-loose-spacing . #t) (axes . (0)) (before-line-breaking . ,ly:paper-column::before-line-breaking) (X-extent . ,ly:axis-group-interface::width)