]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (dashed-line): add phase argument to
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 26 Jul 2006 11:40:14 +0000 (11:40 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 26 Jul 2006 11:40:14 +0000 (11:40 +0000)
dashed-line.

* lily/bar-line.cc (dashed_bar_line): new function.
(compound_barline): support \bar "dashed".

* lily/lily-parser-scheme.cc (LY_DEFINE): only write
--output=DIR to DIR/BASE if it is a dir.

* flower/file-name.cc (file_part): new function
(dir_part): new function

* lily/lily-parser-scheme.cc (LY_DEFINE):

* DEDICATION: update

17 files changed:
ChangeLog
DEDICATION
Documentation/topdocs/NEWS.tely
flower/file-name.cc
flower/include/file-name.hh
input/regression/bar-line-dashed.ly [new file with mode: 0644]
lily/bar-line.cc
lily/include/bar-line.hh
lily/instrument-name-engraver.cc
lily/lily-parser-scheme.cc
lily/line-interface.cc
python/convertrules.py
scm/define-grobs.scm
scm/output-ps.scm
scm/output-svg.scm
scm/output-tex.scm
scripts/midi2ly.py

index 1bf8a51173fc3b7ffabe93476c486378eefc3d71..91450f9371130a76052715eb4fd91a9939b97a8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,33 @@
+2006-07-26  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * scm/output-ps.scm (dashed-line): add phase argument to
+       dashed-line.
+
+       * lily/bar-line.cc (dashed_bar_line): new function.
+       (compound_barline): support \bar "dashed". 
+
+       * lily/lily-parser-scheme.cc (LY_DEFINE): only write
+       --output=DIR to DIR/BASE if it is a dir. 
+
+       * flower/file-name.cc (file_part): new function
+       (dir_part): new function
+
+       * lily/lily-parser-scheme.cc (LY_DEFINE): 
+
+       * DEDICATION: update
+
+2006-07-25  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * lily/instrument-name-engraver.cc: formatting.
+
+       * python/convertrules.py (conv): bugfix for \epsfile.
+
 2006-07-25  Joe Neeman  <joeneeman@gmail.com>
 
        * lily/grob.cc:
-       * lily/gourlay-breaking.cc: Oops, these should have been included in my last
-       commit
+       
+       * lily/gourlay-breaking.cc: Oops, these should have been included
+       in my last commit
 
 2006-07-24  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
index f7bbafa0a44dd4de56a7edbcb1de7e762c05095f..264945471ce05befa9c9d3b79bc7ed36b286367c 100644 (file)
@@ -8,8 +8,8 @@
        Those deserving special mentioning (in no particular order):
 Esther, Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn,
 Maartje, Suzanne, Ilse (gee, again?), Marieke, Irene, Martine, Idwine,
-Hanna, Lonneke, Elisha, Anna and last (but certainly not least)
-Janneke!
+Hanna, Lonneke, Elisha, Anna, Janneke and last (but certainly not
+least) Janneke!
 
        HWN
 
index df0c374f263060dad1b421ee0d6553b4adf45ccd..974baf3111dda93f3a541ce67ba722d6eb18feec 100644 (file)
@@ -66,6 +66,15 @@ which scares away people.
 
 @end ignore
 
+@item
+Barlines can be dashed now,
+
+@lilypond[relative,ragged-right,fragment]
+c4 \bar "dashed" c4
+@end lilypond
+
+This feature was sponsored by Kieren MacMillan.
+
 @item
 Grace notes maybe forced to use floating spacing, 
 
index 66b1aaa1149a38e03d394966985ffaa7878f1ac6..787c27f25a2e18fa17fa0d28b58f10218010fbb8 100644 (file)
@@ -73,7 +73,13 @@ dir_name (string const file_name)
   ssize n = s.length ();
   if (n && s[n - 1] == '/')
     s[n - 1] = 0;
-  s = s.substr (0, s.rfind ('/'));
+  if (s.rfind ('/') != NPOS)
+    {
+      s = s.substr (0, s.rfind ('/'));
+    }
+  else
+    s = "";
+  
   return s;
 }
 
@@ -88,23 +94,46 @@ get_working_directory ()
 
 /* Join components to full file_name. */
 string
-File_name::to_string () const
+File_name::dir_part () const
 {
   string s;
   if (!root_.empty ())
     s = root_ + ::to_string (ROOTSEP);
+
   if (!dir_.empty ())
     {
       s += dir_;
-      if (!base_.empty () || !ext_.empty ())
-       s += ::to_string (DIRSEP);
     }
-  s += base_;
+
+  return s;
+}
+
+
+string
+File_name::file_part () const
+{
+  string s;
+  s = base_;
   if (!ext_.empty ())
     s += ::to_string (EXTSEP) + ext_;
   return s;
 }
 
+string
+File_name::to_string () const
+{
+  string d = dir_part ();
+  string f = file_part ();
+
+  if (!f.empty ()
+      && !dir_.empty())
+    {
+      d += ::to_string (DIRSEP);
+    }
+
+  return d + f;
+}
+
 File_name::File_name (string file_name)
 {
 #ifdef __CYGWIN__
index edfa72c23f5fe52faf35501a4fe9da28a47bfefa..3d1a2d0fb2fe28e6094868387bd8792e6a331b87 100644 (file)
@@ -27,6 +27,9 @@ public:
 
   bool is_absolute () const;
   string to_string () const;
+
+  string dir_part () const;
+  string file_part () const;
 };
 
 #endif /* FILE_NAME */
diff --git a/input/regression/bar-line-dashed.ly b/input/regression/bar-line-dashed.ly
new file mode 100644 (file)
index 0000000..11138d2
--- /dev/null
@@ -0,0 +1,17 @@
+
+\header { texidoc = "The dashes in a dashed bar line covers staff
+  lines exactly. Dashed barlines between staves start and end on a
+  half dash precisely." }
+
+\version "2.9.13"
+
+\paper {  ragged-right = ##t }
+
+\relative \new StaffGroup <<
+  \new Staff {
+    c4 \bar "dashed" c }
+  \new Staff {
+    c c
+  }
+>>
+
index cd508de8bff81ab48e6cc2daf2252adbcf3d5974..0c5c768f22248dc081242bf834c59275b80922cb 100644 (file)
@@ -14,6 +14,7 @@
 #include "output-def.hh"
 #include "paper-column.hh"
 #include "staff-symbol-referencer.hh"
+#include "line-interface.hh"
 
 MAKE_SCHEME_CALLBACK (Bar_line, print, 1);
 SCM
@@ -131,6 +132,10 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
          m.add_stencil (d);
        }
     }
+  else if (str == "dashed")
+    {
+      m = dashed_bar_line (me, h, hair);
+    }
   else if (str == ".")
     {
       m = dot;
@@ -167,6 +172,72 @@ Bar_line::calc_bar_size (SCM smob)
 }
 
 
+Stencil
+Bar_line::dashed_bar_line (Grob *me, Real h, Real thick)
+{
+  Real dash_size
+    = 1.0 - robust_scm2double (me->get_property ("gap"), 0.3);
+  /*
+    this is a tad complex for what we want to achieve, but with a
+    simple line, the round blotting interferes with staff line
+    connections.
+      */
+  Real ss = Staff_symbol_referencer::staff_space (me);
+  int count = Staff_symbol_referencer::line_count (me);
+      Real line_thick = Staff_symbol_referencer::line_thickness (me);
+
+  if (fabs (line_thick + (count -1) * ss - h) <   0.1) // ugh.
+    {
+      Real blot = 
+       me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
+
+      Real half_space = ss/2;
+      Stencil bar;
+  
+      for (int i = (count-1); i >= -(count-1); i -= 2)
+       {
+         Real top_y = min ((i + dash_size) * half_space,
+                           (count-1) * half_space +  line_thick / 2);
+         Real bot_y = max ((i - dash_size) * half_space,
+                           -(count-1) * half_space - line_thick/2);
+
+         bar.add_stencil (Lookup::round_filled_box (Box (Interval (0,thick),
+                                                         Interval (bot_y, top_y)),
+                                                    blot));
+       }
+      return bar;
+    }
+  else
+    {
+      /*
+       We have to scale the dashing so it starts and ends with half a
+       dash exactly.
+       */
+      int dashes = int (rint (h / ss));
+      Real total_dash_size = h / dashes;
+      Real factor = (dash_size - thick) / ss;
+      
+      SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
+                          scm_from_double (thick),
+                          scm_from_double (factor * total_dash_size),
+                          scm_from_double ((1-factor) * total_dash_size),
+                          scm_from_double (0),
+                          scm_from_double (h),
+                          scm_from_double (factor * total_dash_size * 0.5),
+                          SCM_UNDEFINED);
+
+      Box box;
+      box.add_point (Offset (0, 0));
+      box.add_point (Offset (0, h));
+
+      Stencil s (box, at);
+      s.translate (Offset (thick/2, -h/2));
+      return s;
+    }
+  return Stencil();
+}
+
+
 ADD_INTERFACE (Bar_line,
               "bar-line-interface",
 
@@ -183,10 +254,15 @@ ADD_INTERFACE (Bar_line,
               "These produce, respectively, a right repeat, a left repeat, a double\n"
               "repeat, a double bar, a start bar, an end bar, and a thick double bar.\n"
               "If @var{bartype} is set to @code{empty} then nothing is printed,\n"
-              "but a line break is allowed at that spot.\n",
+              "but a line break is allowed at that spot.\n"
+              "\n\n"
+              "@code{gap} is used for the gaps in dashed barlines."
 
+              ,
 
-              /* properties */ 
+
+              /* properties */
+              "gap "
               "kern "
               "thin-kern "
               "hair-thickness "
@@ -195,3 +271,5 @@ ADD_INTERFACE (Bar_line,
               "glyph-name "
               "bar-size "
               );
+
+
index 4744aef8554d11561513cd79505dc2f6fbcc3745..39253a7b8d39c020063ddd3c3af2f768b4a64dab 100644 (file)
@@ -18,6 +18,7 @@ class Bar_line
 public:
   static bool has_interface (Grob *);
 
+  static Stencil dashed_bar_line (Grob *me, Real h, Real thick);
   static Stencil compound_barline (Grob *, string, Real height, bool rounded);
   static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
   DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
index 2f361f0fe5204f0d2a3393973d733fb0b3043ebd..5a196104794c80f419e32133c10fcd1862c65f5d 100644 (file)
@@ -114,7 +114,11 @@ ADD_TRANSLATOR (Instrument_name_engraver,
                "",
                
                /* read */
-               "vocNam vocalName instrument instr "
-               "currentCommandColumn",
+               "currentCommandColumn "
+               "instr "
+               "instrument "
+               "vocNam "
+               "vocalName "
+               ,
 
                /* write */ "");
index 2521f4e0391d634ccd658b4f396366be678354d0..56de47abbd21945a3ff5ba788027ab5a96240dc8 100644 (file)
@@ -65,6 +65,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
 
   if (!output_name_global.empty ())
     {
+      
       /* Interpret --output=DIR to mean --output=DIR/BASE.  */
       string dir;
       if (is_dir (output_name_global))
@@ -73,7 +74,15 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
          output_name_global = "";
        }
       else
-       dir = dir_name (output_name_global);
+       {
+         File_name out (output_name_global);
+         if (is_dir (out.dir_part ()))
+           {
+             dir = out.dir_part ();
+             out_file_name = out.file_part ();
+           }
+       }         
+
       if (dir != "" && dir != "." && dir != get_working_directory ())
        {
          global_path.prepend (get_working_directory ());
index 6401b3896ae942ced9333c9b101ab43582275ef4..ff7fae57837ddb738f4d9cf352dd91bdab1de9ba 100644 (file)
@@ -44,6 +44,7 @@ Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
                       scm_from_double (off),
                       scm_from_double (to[X_AXIS] - from[X_AXIS]),
                       scm_from_double (to[Y_AXIS] - from[Y_AXIS]),
+                      scm_from_double (0.0),
                       SCM_UNDEFINED);
 
   Box box;
index 7ba205c49891dcfe3826c11a1948f11e8c420734..1d128d38a77188047e89bc72f1080d7aa856e9c4 100644 (file)
@@ -2691,7 +2691,7 @@ conversions.append (((2, 7, 29), conv,
                     """override Stem #'beamed-* -> #'details #'beamed-*"""))
 
 def conv (str):
-    str = re.sub (r'\epsfile *#"', r'\epsfile #X #10 #"', str)
+    str = re.sub (r'\\epsfile *#"', r'\\epsfile #X #10 #"', str)
     return str
 
 conversions.append (((2, 7, 30), conv,
index b0d023b2befa0a4f701de99c0ff1f4f3ac81c11c..d4c363604361eadeca8ca4065d954aa52aa52646 100644 (file)
      . (
        (break-align-symbol . staff-bar)
        (glyph . "|")
+       (gap . 0.4)
        (layer . 0)
        (break-visibility . ,all-visible)
        (non-musical . #t)
index 010e8f15a294da66383bc69105a7e1b1d8b298c1..108771ee4b9bb2c51da3c2e06a6f523c20615c00 100644 (file)
      "false")
    (round4 radius) (round4 thick)))
 
-(define (dashed-line thick on off dx dy)
-  (format #f "~a ~a ~a [ ~a ~a ] 0 draw_dashed_line"
+(define (dashed-line thick on off dx dy phase)
+  (format #f "~a ~a ~a [ ~a ~a ] ~a draw_dashed_line"
    (str4 dx)
    (str4 dy)
    (str4 thick)
    (str4 on)
-   (str4 off)))
+   (str4 off)
+   (str4 phase)
+   
+   ))
 
 ;; what the heck is this interface ?
 (define (dashed-slur thick on off l)
index 3ed5e22c148d5dc152839ae2972f088257b2d4fa..2e953a94b29591dc8236c33d23b3e6f18eb95cbd 100644 (file)
            (y2 . ,(- y2)))
          alist)))
 
-(define (dashed-line thick on off dx dy)
+(define (dashed-line thick on off dx dy phase)
   (draw-line thick 0 0 dx dy `(style . ,(format "stroke-dasharray:~a,~a;" on off))))
 
 (define (named-glyph font name)
index c9697f5f12a718ea005926bf510a87178f5073f9..0f36375f0db97f49dbeabc7f5593e56415f37bcf 100644 (file)
@@ -98,8 +98,8 @@
          (ly:warning (_ "can't find ~a in ~a" name font))
          ""))))
 
-(define (dashed-line thick on off dx dy)
-  (embedded-ps (list 'dashed-line  thick on off dx dy)))
+(define (dashed-line thick on off dx dy phase)
+  (embedded-ps (list 'dashed-line  thick on off dx dy phase)))
 
 (define (zigzag-line centre? zzw zzh thick dx dy)
   (embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy)))
index e35e9d13eac36119ce0b209a09506cd61b64b29c..4a0d956211a3b185a318ecd8c3f5626d4b51ad98 100644 (file)
@@ -33,8 +33,6 @@ for d in ['@lilypond_datadir@',
           '@lilypond_libdir@']:
     sys.path.insert (0, os.path.join (d, 'python'))
 
-sys.path.insert (0, os.path.join (datadir, 'python'))
-
 # dynamic relocation, for GUB binaries.
 bindir = os.path.abspath (os.path.split (sys.argv[0])[0])
 for p in ['share', 'lib']: