Re: Formatting ChordPro music charts

2011-11-10 Thread Jan Schenkel
Hi Mark,

Glad to be of assistance. I just took another look at it, and realized that 
there's still a case where my algorithm didn't work: when the lyrics under the 
chord are shorter than the chord. The following adapted version should fix that 
for you:

##
on mouseUp
   put ChordProPrintText(field ChordProText) into field PrintText
end mouseUp

private function ChordProPrintText pChordProText
   local tPrintText, tLine, tIndex, tInBracketFlag, tChords, tLyrics
   repeat for each line tLine in pChordProText
  put empty into tChords
  put empty into tLyrics
  put false into tInBracketFlag
  repeat with tIndex = 1 to the number of characters in tLine
 if char tIndex of tLine is [ then
    put true into tInBracketFlag
    if tChords is not empty and char -1 of tChords is not space then
   put space after tChords
    end if
    repeat (the number of characters in tChords) - (the number of 
characters in tLyrics) times
   put space after tLyrics
    end repeat
 else if char tIndex of tLine is ] then
    put false into tInBracketFlag
 else if tInBracketFlag is true then
    put char tIndex of tLine after tChords
 else
    put char tIndex of tLine after tLyrics
    if the number of characters in tChords  the number of characters 
in tLyrics then
   put space after tChords
    end if
 end if
  end repeat
  put tChords  return  tLyrics  return after tPrintText
   end repeat
   return char 1 to -2 of tPrintText -- no trailing return
end ChordProPrintText

##


Cheers,

Jan Schenkel.

=
Quartam Reports  PDF Library for LiveCode
www.quartam.com


=
As we grow older, we grow both wiser and more foolish at the same time.  (La 
Rochefoucauld)



From: Mark Stuart mfstu...@cox.net
To: use-revolut...@lists.runrev.com
Sent: Tuesday, November 8, 2011 5:49 PM
Subject: Re: Formatting ChordPro music charts

Jan, you are brilliant. Thank you very much for the script, it works exactly
as expected.
Even with chords like Dsus2, F#, Bb, Cm7, etc.

So thanx again. Now to finish this project... another story.

Regards,
Mark Stuart
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Formatting ChordPro music charts

2011-11-08 Thread Jan Schenkel
Yes it would - that's how most guitar tab music sites will display it.
Otherwise it's a little trickier to figure out the string width and insert 
appropriate 1 pixel wide spaces.

 
Jan Schenkel.

=
Quartam Reports  PDF Library for LiveCode
www.quartam.com


=
As we grow older, we grow both wiser and more foolish at the same time.  (La 
Rochefoucauld)



From: Colin Holgate co...@verizon.net
To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Tuesday, November 8, 2011 7:18 AM
Subject: Re: Formatting ChordPro music charts

Jan, does your routine require that it be a monospaced font?

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Formatting ChordPro music charts

2011-11-08 Thread Mark Stuart
Jan, you are brilliant. Thank you very much for the script, it works exactly
as expected.
Even with chords like Dsus2, F#, Bb, Cm7, etc.

So thanx again. Now to finish this project... another story.

Regards,
Mark Stuart

--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Formatting-ChordPro-music-charts-tp4014902p4016678.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Formatting ChordPro music charts

2011-11-07 Thread Jan Schenkel
Ooh, another breakfast cereal challenge - what better way to start the day? :-)
Here's my take on it; only lightly tested but looked alright in my variations:

##
on mouseUp
   putChordProPrintText(fieldChordProText) intofieldPrintText
end mouseUp

private function ChordProPrintText pChordProText
   local tPrintText, tLine, tIndex, tInBracketFlag, tChords, tLyrics
   repeat for each line tLine in pChordProText
      put empty into tChords
      put empty into tLyrics
      put false into tInBracketFlag
      repeat with tIndex = 1 to the number of characters in tLine
         if char tIndex of tLine is [ then
            put true into tInBracketFlag
         else if char tIndex of tLine is ] then
            put false into tInBracketFlag
         else if tInBracketFlag is true then
            put char tIndex of tLine after tChords
         else
            put char tIndex of tLine after tLyrics
            if the number of characters in tChords  the number of characters 
in tLyrics then
               put space after tChords
            end if
         end if
      end repeat
      put tChords  return  tLyrics  return after tPrintText
   end repeat
   return char 1 to -2 of tPrintText -- no trailing return
end ChordProPrintText
##

HTH,

Jan Schenkel.
=
Quartam Reports  PDF Library for LiveCode
www.quartam.com


=
As we grow older, we grow both wiser and more foolish at the same time.  (La 
Rochefoucauld)



From: Mark Stuart mfstu...@cox.net
To: use-livecode@lists.runrev.com
Sent: Tuesday, November 8, 2011 6:06 AM
Subject: Formatting ChordPro music charts

Hi all,
Anyone familiar with the ChordPro music chart format?
I want to build a desktop app that would allow the user to edit the song
chart, and then print it, all using the ChordPro format.

Editing the chart looks like this:

[A]This is my [D]song
[A]It's not very [D]long
[A]Hey.

When printed it looks like this:

A          D
This is my song
A             D
It's not very long
A
Hey

The key is printed directly above where the key was entered into the chart.
The printing script would have to read each line, looking for the opening [
square bracket, look for the next closing ] square bracket, and format that
content into a line including spacing based on the line it found the square
brackets on.

I'm not sure how to do that. Anyone with some ideas on this?

Regards,
Mark Stuart


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Formatting ChordPro music charts

2011-11-07 Thread Colin Holgate
Jan, does your routine require that it be a monospaced font?

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode