]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.34.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 16 Mar 2000 12:30:41 +0000 (13:30 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 16 Mar 2000 12:30:41 +0000 (13:30 +0100)
1.3.34.jcn3
===========

* Small enhancements to Staff_margin_engraver:
   - by default, the marginScript left aligns the text
   - to set the text style, use property marginScriptTextStyle
   - to change the alignment, use property marginScriptHorizontalAlignment
     (centred and right alignment require manual padding settings).

CHANGES
VERSION
input/test/coriolan-margin.ly
lily/staff-margin-engraver.cc
ly/engraver.ly

diff --git a/CHANGES b/CHANGES
index 1b19b2dcd6b55a7a137bee6e9fe3c33a16b210b4..17988e6c44b867f04f149ee7c3f6eeff77c9293c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,12 @@
+1.3.34.jcn3
+===========
+
+* Small enhancements to Staff_margin_engraver:
+   - by default, the marginScript left aligns the text
+   - to set the text style, use property marginScriptTextStyle
+   - to change the alignment, use property marginScriptHorizontalAlignment
+     (centred and right alignment require manual padding settings).
+
 1.3.34.jcn2
 ===========
 
diff --git a/VERSION b/VERSION
index 035504b9c936c4843a5334d95ce3cf00f3c8c5ed..8bbc082e159b448d9e093c3b7e9aa68be8b5b5d1 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=34
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=jcn3
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 3f323c24e01405e5bab802b083168d12a4803ecb..ed5103356dfd5f0e299eea94e00e02c2c0d08ba5 100644 (file)
@@ -3,6 +3,8 @@ flauti = \notes \relative c' {
   \property Staff.instr                = #"Fl."
   c1 
   \break c
+%  \break c
+%  \break c
   \bar"|.";
 }
 
@@ -61,7 +63,8 @@ violino2 = \notes \relative c' {
 viola = \notes \relative c' {
   \property Staff.instrument   = #"Viola"
   \property Staff.instr                = #"Vla."
-  c1 c
+  c1 c 
+  %c
 }
 
 violoncello = \notes \relative c' {
@@ -121,6 +124,9 @@ violoncello = \notes \relative c' {
       \ScoreContext
       instrumentScriptPadding = #55  %% urg, this is in pt
       instrScriptPadding = #35
+      marginScriptHorizontalAlignment = #1
+      %marginScriptPadding = #15
+      %marginScriptHorizontalAlignment = #0
     }
   }
 }
index 3472bcf54f101f278138f918046c26df79e5eb9f..88adb28af6ecbf3713bd17a4c8e22a7da4e7d289 100644 (file)
@@ -10,6 +10,7 @@
 #include "engraver.hh"
 #include "bar.hh"
 #include "dimension-cache.hh"
+#include "directional-element-interface.hh"
 #include "timing-translator.hh"
 #include "text-item.hh"
 #include "side-position-interface.hh"
@@ -20,7 +21,8 @@
 /*
   TODO:
 
-    * padding
+    * align over full score
+    * text aligment: left, centred, right
     * merge with/derive from/add functionality to Bar_script_engraver
  */
 
@@ -105,28 +107,73 @@ Staff_margin_engraver::create_text (SCM text)
       // 'just to be sure': see Clef_item::do_add_processing
       l->add_dependency (t);
 
-      announce_element (Score_element_info (t, 0));
 
       /*
        Hmm.
        In almost every score that uses "instrument" and "instr"
        we need two different paddings.
        Let's try one of those first:
-          instrumentScriptPadding/instrScriptPadding
-       */
+       instrumentScriptPadding/instrScriptPadding
+      */
       SCM s = get_property (String (now_mom () ? "instr" : "instrument")
                            + "ScriptPadding");
       if (!gh_number_p (s))
        s = get_property (type_ + "ScriptPadding");
+
+      Real padding = 0;
       if (gh_number_p (s))
+       padding = gh_scm2double (s);
+  
+      s = get_property (type_ + "ScriptTextStyle");
+      if (gh_string_p (s))
+       t->set_elt_property ("style", s);
+
+      s = get_property (type_ + "ScriptHorizontalAlignment");
+      /*
+        Allow centred,
+       */
+      if (gh_number_p (s) && !gh_scm2int (s))
+       {
+         t->set_elt_property ("self-alignment-X", gh_int2scm (0));
+         t->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS);
+         /*
+%          Centred is still broken, it always requires proper padding.
+          */
+         padding *= -1;
+         if (padding)
+           t->translate_axis (padding, X_AXIS);
+       }
+      /*
+       left or right alignment.
+      */
+      else
        {
-         //t->set_elt_property ("padding", s);
-         t->translate_axis (-gh_scm2double (s), X_AXIS);
+         side_position (t).set_axis (X_AXIS);
+         side_position (t).add_support (l);
+      
+         Direction d;
+         if (isdir_b (s))
+           d = to_dir (s);
+         /*
+           By default, align at left edge of Left_edge_item,
+           (which makes text right-aligned)
+           so that we don't collide with staff.
+         */
+         else
+           d = LEFT;
+         
+         directional_element (t).set (d);
+         padding *= -d;
+         if (padding)
+           t->set_elt_property ("padding", gh_double2scm (padding));
        }
+
+
+      announce_element (Score_element_info (t, 0));
       text_p_ = t;
     }
-  //text_p_->set_elt_property ("style", s);
-  //text_p_->set_elt_property ("direction", gh_int2scm (RIGHT));
+
+
   text_p_->set_elt_property ("text", text);
 }
 
index 0f179cb3c999b55aa6218d01ee5e0c2857eff27e..a97abe6d6e029ccf44329aaa868de1ac8b623e62 100644 (file)
@@ -322,6 +322,8 @@ ScoreContext = \translator {
        \type Score_engraver;
        \name Score;
 
+       marginScriptPadding = #10  % urg, in \pt
+
        \consists "Timing_engraver";
        \consists "Output_property_engraver";