Re: Overriding bar-line behaviour

2011-02-17 Thread Matthias Hüsken
> > What I'd like to achieve:
> > When ending a bar with the repetition sign ":|",
> > I need double lines ("||") at the beginning of the next bar.
>
> It looks as though you actually mean ending/beginning lines, not bars.

Basically, yes.

> > [...]
> > (":||" . (":|" . "||"))
> > [...]
> > Unfortunately, this does not work:
> > LilyPond leaves the  end of the line [...] empty,
> > as well as the beginning of the next line.
>
> Lilypond's barline.cc doesn't recognise your bartype string ":||"
> and quietly sets the bartype to empty before continuing.
> So unless you extend the C++ hardcoding you are limited
> to the bartypes listed in the bar-line-interface documentation.

Well, I do not think the problem actually lies in the C++ code but in the way 
I tried to override bar-glyph-alist - when I change the code in 
scm/output-lib.scm, it does work... even with \bar ":||".

> If you will be using explicit line breaks like in your snippet I would
> suggest a \once-like approach as in the attached barRightrepeatDouble.ly.

This solution works perfectly, thanks a lot! What I actually use is this code:

barCustom =
#(define-music-function (parser location one two) (string? string?)
#{
\once \override Score.BarLine #'break-visibility = #all-visible
\once \override Score.BarLine #'glyph-name = #(lambda(grob)
(if (not (= (ly:item-break-dir grob) RIGHT)) $one $two))
#})

and then e.g. \barCustom ":|" "||"

There is only one detail that need additional attention: It is not possbile to 
change the bar lines at the beginning of the first line with this method. I 
found the following workaround:

% start first line with repeat
\bar "|:"
% start first line with "thick" double lines
\bar ".|"
% start first line with "thin" double lines
\once \override Score.BarLine #'glyph-name = "||" \bar "|:"


Thanks again for finding a solution!

Matthias


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Overriding bar-line behaviour

2011-02-16 Thread Robin Bannister

Matthias Hüsken wrote:

What I'd like to achieve:
When ending a bar with the repetition sign ":|",
I need double lines ("||") at the beginning of the next bar.


It looks as though you actually mean ending/beginning lines, not bars.



[...]
(":||" . (":|" . "||"))
[...]
Unfortunately, this does not work:
LilyPond leaves the  end of the line [...] empty,
as well as the beginning of the next line.


Lilypond's barline.cc doesn't recognise your bartype string ":||"
and quietly sets the bartype to empty before continuing.
So unless you extend the C++ hardcoding you are limited
to the bartypes listed in the bar-line-interface documentation.


If you will be using explicit line breaks like in your snippet I would
suggest a \once-like approach as in the attached barRightrepeatDouble.ly.


Cheers,
Robin 
barRightrepeatDouble = 
{
  \once \override Score.BarLine #'break-visibility = #all-visible 
  \once \override Score.BarLine #'glyph-name = #(lambda(grob) 
  (if (not (= (ly:item-break-dir grob) RIGHT)) ":|" "||"))
}

\new Score
{
  \new Staff
  {
\bar "|:" g'1 \barRightrepeatDouble \break
g'1 \bar "||" \break
  }
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Overriding bar-line behaviour

2011-02-16 Thread Matthias Hüsken
Ok, I give up for tonight - obviously, before writing my last mail I tested 
while having the new barline definitions in scm/output-lib.scm (instead of 
reverting that file).

Which means I cannot get things to work without modifying scm/output-lib.scm. 
Any ideas how to put this into a .ly file are most welcome...

Matthias


Am Mittwoch, 16. Februar 2011 schrieb Matthias Hüsken:
> Sorry for the noise on the mailing list - I knew it was some stupid
> mistake... I tried to override the wrong value, it should have been
>
> \override Score.BarLine #'break-glyph-function =
> #my-bar-line::calc-glyph-name
>
> instead of
>
> \override Staff.BarLine #'glyph-name = #my-bar-line::calc-glyph-name
>
> Corrected file attached. Cheers,
>
> Matthias
>
> Am Mittwoch, 16. Februar 2011 schrieb Matthias Hüsken:
> > Hi again,
> >
> > while trying to change LilyPond's behaviour concerning bar lines, I
> > stumbled upon some strange behaviour. What I'd like to achieve: When
> > ending a bar with e repetition sign ":|", I need double lines ("||") at
> > the beginning of the next bar.
> >
> > I found bar-glyph-alist in scm/output-lib.scm and decided to change it to
> > the following lines (shortened for this example):
> >
> > #(define bar-glyph-alist
> >   '(
> > ;; regular bar
> > ("|" . ("|" . ()))
> > ;; repetitions
> > ("|:" . ("|" . "|:"))
> > (":|" . (":|" . ()))
> > (":|:" . (":|" . "|:"))
> > ;; double lines
> > ("||" . ("||" . ()))
> > ;; double lines combined with repetitions
> > ("||:" . ("||" . "|:"))
> > (":||" . (":|" . "||"))
> > ))
> >
> > When setting music now, everything works as expected.
> >
> > As I consider changing LilyPond's default files as hacking, I decided to
> > move the list into my .ly file (see attached file) and revert
> > scm/output-lib.scm to its original state. Unfortunately, this does not
> > work: LilyPond leaves the end of the line (where a repetition sign ":|"
> > should be found) empty, as well as the beginning of the next line.
> >
> > Does anyone have any clues what's going wrong?
> >
> > Thanks,
> >
> > Matthias



-- 

Matthias Hüsken  Phone: +49 202 439-3362
Fachbereich Mathematik   Fax:   +49 202 439-2912
Bergische Universität
Gaußstraße 20
D - 42097 Wuppertal

e-mail: matthias.hues...@math.uni-wuppertal.de


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Overriding bar-line behaviour

2011-02-16 Thread Matthias Hüsken
Sorry for the noise on the mailing list - I knew it was some stupid mistake... 
I tried to override the wrong value, it should have been

\override Score.BarLine #'break-glyph-function = #my-bar-line::calc-glyph-name

instead of

\override Staff.BarLine #'glyph-name = #my-bar-line::calc-glyph-name

Corrected file attached. Cheers,

Matthias



Am Mittwoch, 16. Februar 2011 schrieb Matthias Hüsken:
> Hi again,
>
> while trying to change LilyPond's behaviour concerning bar lines, I
> stumbled upon some strange behaviour. What I'd like to achieve: When ending
> a bar with e repetition sign ":|", I need double lines ("||") at the
> beginning of the next bar.
>
> I found bar-glyph-alist in scm/output-lib.scm and decided to change it to
> the following lines (shortened for this example):
>
> #(define bar-glyph-alist
>   '(
> ;; regular bar
> ("|" . ("|" . ()))
> ;; repetitions
> ("|:" . ("|" . "|:"))
> (":|" . (":|" . ()))
> (":|:" . (":|" . "|:"))
> ;; double lines
> ("||" . ("||" . ()))
> ;; double lines combined with repetitions
> ("||:" . ("||" . "|:"))
> (":||" . (":|" . "||"))
> ))
>
> When setting music now, everything works as expected.
>
> As I consider changing LilyPond's default files as hacking, I decided to
> move the list into my .ly file (see attached file) and revert
> scm/output-lib.scm to its original state. Unfortunately, this does not
> work: LilyPond leaves the end of the line (where a repetition sign ":|"
> should be found) empty, as well as the beginning of the next line.
>
> Does anyone have any clues what's going wrong?
>
> Thanks,
>
> Matthias



-- 

Matthias Hüsken  Phone: +49 202 439-3362
Fachbereich Mathematik   Fax:   +49 202 439-2912
Bergische Universität
Gaußstraße 20
D - 42097 Wuppertal

e-mail: matthias.hues...@math.uni-wuppertal.de

\version "2.12.2"

% override default bar types to allow arbitrarily placed bar lines
#(define my-bar-glyph-alist
  '(
;; regular bar
("|" . ("|" . ()))
;; repetitions
("|:" . ("|" . "|:"))
(":|" . (":|" . ()))
(":|:" . (":|" . "|:"))
;; double lines
("||" . ("||" . ()))
;; double lines combined with repetitions
("||:" . ("||" . "|:"))
(":||" . (":|" . "||"))
))

#(define (my-bar-line::calc-glyph-name grob)
  (let* (
  (index-cell (lambda (cell dir)
(if (equal? dir 1)
(cdr cell)
(car cell
  (glyph (ly:grob-property grob 'glyph))
  (dir (ly:item-break-dir grob))
  (result (assoc glyph  my-bar-glyph-alist))
  (glyph-name (if (= dir CENTER)
glyph
(if (and result (string? (index-cell (cdr result) dir)))
(index-cell (cdr result) dir)
#f)))
)
  glyph-name
  ))


\new Score
{
\new Staff
{
\override Score.BarLine #'break-glyph-function = 
#my-bar-line::calc-glyph-name
\bar "|:" g'1 \bar ":||" \break
g'1 \bar "||" \break
}
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Overriding bar-line behaviour

2011-02-16 Thread Matthias Hüsken
Hi again,

while trying to change LilyPond's behaviour concerning bar lines, I stumbled 
upon some strange behaviour. What I'd like to achieve: When ending a bar with 
e repetition sign ":|", I need double lines ("||") at the beginning of the 
next bar.

I found bar-glyph-alist in scm/output-lib.scm and decided to change it to the 
following lines (shortened for this example):

#(define bar-glyph-alist
  '(
;; regular bar
("|" . ("|" . ()))
;; repetitions
("|:" . ("|" . "|:"))
(":|" . (":|" . ()))
(":|:" . (":|" . "|:"))
;; double lines
("||" . ("||" . ()))
;; double lines combined with repetitions
("||:" . ("||" . "|:"))
(":||" . (":|" . "||"))
))

When setting music now, everything works as expected.

As I consider changing LilyPond's default files as hacking, I decided to move 
the list into my .ly file (see attached file) and revert scm/output-lib.scm 
to its original state. Unfortunately, this does not work: LilyPond leaves the 
end of the line (where a repetition sign ":|" should be found) empty, as well 
as the beginning of the next line.

Does anyone have any clues what's going wrong?

Thanks,

Matthias

\version "2.12.2"

% override default bar types to allow arbitrarily placed bar lines
#(define my-bar-glyph-alist
  '(
;; regular bar
("|" . ("|" . ()))
;; repetitions
("|:" . ("|" . "|:"))
(":|" . (":|" . ()))
(":|:" . (":|" . "|:"))
;; double lines
("||" . ("||" . ()))
;; double lines combined with repetitions
("||:" . ("||" . "|:"))
(":||" . (":|" . "||"))
))

#(define (my-bar-line::calc-glyph-name grob)
  (let* (
  (index-cell (lambda (cell dir)
(if (equal? dir 1)
(cdr cell)
(car cell
  (glyph (ly:grob-property grob 'glyph))
  (dir (ly:item-break-dir grob))
  (result (assoc glyph  my-bar-glyph-alist))
  (glyph-name (if (= dir CENTER)
glyph
(if (and result (string? (index-cell (cdr result) dir)))
(index-cell (cdr result) dir)
#f)))
)
  glyph-name
  ))


\new Score
{
\new Staff
{
\override Staff.BarLine #'glyph-name = #my-bar-line::calc-glyph-name

\bar "|:" g'1 \bar ":||" \break
g'1 \bar "||" \break
}
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user