Preserve ordering of grooves within a style

This commit is contained in:
Matthias Neeracher 2007-05-02 05:28:22 +00:00
parent c3d4e6d2b8
commit d33b9ed728
2 changed files with 15 additions and 4 deletions

View File

@ -21,7 +21,7 @@
[[NSBundle mainBundle] pathForResource:@"Grooves" ofType:@"plist"]];
fSubStyleFilter =
[[NSPredicate predicateWithFormat:
@"!(SELF like[c] '.DESC') AND !(SELF matches[c] '.*(Intro|End)\\\\d*$')"]
@"!(SELF matches[c] '.*(Intro|End)\\\\d*$')"]
retain];
fDocument = [view document];
@ -78,7 +78,7 @@
[fSubStyleList release];
fStyle = [[[fBrowser selectedCellInColumn:0] stringValue] retain];
fSubStyles = [fGrooves objectForKey:fStyle];
fSubStyleList = [[[fSubStyles allKeys]
fSubStyleList = [[[fSubStyles objectForKey:@".ORDER"]
filteredArrayUsingPredicate:fSubStyleFilter]
retain];
}

View File

@ -16,6 +16,7 @@ Find.find(ARGV[0]) do |f|
elsif f =~ %r|.*/(\S+?).mma$|
style = $1
g = {}
o = []
doc = ""
groove= ""
File.open(f) do |file|
@ -33,6 +34,7 @@ Find.find(ARGV[0]) do |f|
elsif line =~ /^\s*DefGroove\s+(\S+)\s+(.+?)\s*$/
groove = $1
gdoc = $2
o.push(groove)
if gdoc =~ /(.*?)\s+\\\s*$/
gdoc = $1
inCont = true
@ -50,6 +52,7 @@ Find.find(ARGV[0]) do |f|
end
unless g.empty?
g[".DESC"] = doc.lstrip
g[".ORDER"] = o
grooves[style] = g
end
end
@ -73,8 +76,16 @@ grooves.each do |style,grooves|
OUT.puts "\t<dict>"
grooves.each do |name,desc|
OUT.puts "\t\t<key>#{xmlesc(name)}</key>"
if name == ".ORDER"
OUT.puts "\t\t<array>"
desc.each do |name|
OUT.puts "\t\t\t<string>#{xmlesc(name)}</string>"
end
OUT.puts "\t\t</array>"
else
OUT.puts "\t\t<string>#{xmlesc(desc)}</string>"
end
end
OUT.puts "\t</dict>"
end