lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changes the Y offset callback of multi-measure rest. (issue4389047)


From: Colin Campbell
Subject: Re: Changes the Y offset callback of multi-measure rest. (issue4389047)
Date: Mon, 11 Apr 2011 22:53:32 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8

On 11-04-11 05:11 PM, address@hidden wrote:
Reviewers: ,

Message:
I was able to figure out a way to do this w/o an extra offset (I think).
 Please, read, test, & report back.

Cheers,
MS

Description:
Changes the Y offset callback of multi-measure rest.

Please review this at http://codereview.appspot.com/4389047/

Affected files:
  A input/regression/multi-measure-rest-y-offset.ly
  M lily/multi-measure-rest.cc
  M scm/define-grobs.scm
  M scm/output-lib.scm


Index: input/regression/multi-measure-rest-y-offset.ly
diff --git a/input/regression/multi-measure-rest-y-offset.ly b/input/regression/multi-measure-rest-y-offset.ly
new file mode 100644
index 0000000000000000000000000000000000000000..480d5731cbdff96f1f8fafdb2b72a22c60393461
--- /dev/null
+++ b/input/regression/multi-measure-rest-y-offset.ly
@@ -0,0 +1,15 @@
+\version "2.13.60"
+\header {
+  texidoc = "The multi-measure rest's automatic vertical shifting can
+be turned off with the automatic-shift property."
+}
+
+\paper {
+  ragged-right = ##t
+}
+
+\relative c' {
+  R1
+  \override Staff . MultiMeasureRest #'Y-offset = #0
+  R1
+}
\ No newline at end of file
Index: lily/multi-measure-rest.cc
diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index 9628402a5ecec1ce899d4ef1d4ea57002b7529af..4e3a32f50c2fedec4f6795810cd4048ad3f10912 100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -137,8 +137,6 @@ Multi_measure_rest::symbol_stencil (Grob *me, Real space)
       return s;
     }

-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-
   Font_metric *musfont = Font_interface::get_default_font (me);

   SCM sml = me->get_property ("use-breve-rest");
@@ -156,12 +154,6 @@ Multi_measure_rest::symbol_stencil (Grob *me, Real space)
     {
Stencil s = musfont->find_by_name (Rest::glyph_name (me, 0, "", true));

-      /*
-        ugh.
-      */
-      if (Staff_symbol_referencer::get_position (me) == 0.0)
-        s.translate_axis (staff_space, Y_AXIS);
-
s.translate_axis ((space - s.extent (X_AXIS).length ()) / 2, X_AXIS);

       return s;
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 84c3f72f8fbb72c715ebab652bd81c2780b31998..a167659ed264a61402318c060e768bac38b2f7d9 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1309,7 +1309,7 @@
     (staff-position . 0)
     (stencil . ,ly:multi-measure-rest::print)
     (thick-thickness . 6.6)
-    (Y-offset . ,ly:staff-symbol-referencer::callback)
+    (Y-offset . ,multi-measure-rest::callback)
     (meta . ((class . Spanner)
          (interfaces . (font-interface
                 multi-measure-interface
Index: scm/output-lib.scm
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 27c69fdfbe82eba10f1d3dcc20fe8156863c0926..1c2da4e7234c6835770934c74659d8dc7f876d3c 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -780,6 +780,15 @@ between the two text elements."


 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; multi-measure-rest
+
+(define-public (multi-measure-rest::callback grob)
+  (let ((y-offset (ly:staff-symbol-referencer::callback grob)))
+ (if (and (eq? (ly:grob-property grob 'measure-count) 1) (eqv? y-offset 0.0))
+        (ly:staff-symbol-staff-space grob)
+        y-offset)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; fret boards

 (define-public (fret-board::calc-stencil grob)


Compiled cleanly and make check seemed OK, barring an assortment of midi logs and an almost unnoticeable shift in partcombine-midi.ly

When Mike confirms that this applies to issue 1604, I'll update the issue and set the patch status to "review".

Colin

--
The test of our progress is not whether we add more to the abundance
of those who have much, it is whether we provide enough for those who
have too little.
-Franklin D. Roosevelt, 32nd US President (1882-1945)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]