Skip to content

Commit

Permalink
Merge branch 'release/1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bwl21 committed Sep 8, 2017
2 parents e5b0555 + 6f9ef27 commit 0835408
Show file tree
Hide file tree
Showing 18 changed files with 779 additions and 4,266 deletions.
10 changes: 7 additions & 3 deletions 30_sources/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* tuplet lines are now correct in pdf (#139)
* no longer have unexpected subflowlines to unisons (#140)
* fixed size of smaall notes (#143)
* player also plays until tied notes edn (#147)
* player also plays until end of tied notes (#147)
* decorations now also work on rests (#127)
* shift now also works on unisons (#107)
* abc2svg settings no longer necessary in tunes (removed from Template) (#71)
Expand All @@ -19,7 +19,7 @@
* fix predefined annotations vt and vr
* BWC: move Tuplet configuration to notebounds (#168)
* Multiple notebound annotations can now be dragged individually (#170)

* BWC: no longer show (Original in ) in case of transpositions (#174)

## enhancement

Expand All @@ -36,6 +36,9 @@
* now menu also shows title of extracts (#153)
* ctrl-alt 'F' now toggles harp preview
* rearranged "Edit Configuration" Menu to improve configuration workflow (#171)
* now suppoert tilde as non braeking space in lyrics, stringnames, annotations #113
* now suppoert quoted tilde as non braeking space in lyrics, stringnames, annotations #113
* layoutlines is now the combination of voices and layoutlines (#175).

## internal stuff

Expand All @@ -51,9 +54,10 @@
## backwards compatibility issues

* layoutlines is now the combination of voices and layoutlines.
It is no longer possible to show voices without considering them in the layout.
It is no longer possible to show voices without considering them in the layout (#175)
* Default for "filenamepart" is now as it was in 1.5 (#155)
* tuplet configuration is now under 'notebound': meed to rework in the sheets - sorry! (#168)
* transposititions are no longer exposed in legend (#174)

## known issues

Expand Down
Binary file not shown.
3 changes: 2 additions & 1 deletion 30_sources/SRC_Zupfnoter/src/abc2svg_to_harpnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def _make_metadata
tempo: {duration: duration, bpm: bpm, sym: tempo_note},
tempo_display: tempo_display,
meter: @info_fields[:M],
key: "#{key} #{o_key_display}"
key: key,
o_key: o_key_display
}
end

Expand Down
59 changes: 42 additions & 17 deletions 30_sources/SRC_Zupfnoter/src/conf_doc_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,34 @@
require 'init_conf'
require 'confstack'

HELP_DE_INPUT = "localization/help_de-de.md"
HELP_DE_INPUT = "localization/help_de-de.md"
HELP_DE_OUTPUT_MD = "../../UD_Zupfnoter-Handbuch/090_UD_Zupfnoter-Konfiguration.md"


# init_conf uses symbols. This does not matter in Opal
# but ruby it is a difference. So we have to stringify the keys.
class Hash
# Returns a deep copy of hash.
#
# hash = { a: { b: 'b' } }
# dup = hash.deep_dup
# dup[:a][:c] = 'c'
#
# hash[:a][:c] # => nil
# dup[:a][:c] # => "c"
def stringify_keys
hash = {}
each_pair do |key, value|
if value.is_a? Hash
hash[key.to_s] = value.stringify_keys
else
hash[key.to_s] = value
end
end
hash
end
end

class ConfDocProvider

attr_reader :entries_html, :entries_md
Expand Down Expand Up @@ -47,18 +72,19 @@ def get_example(conf, key)
:limit_a3, :LINE_THIN, :LINE_MEDIUM, :LINE_THICK, :ELLIPSE_SIZE, :REST_SIZE, # sort within laoyut
"0", "1", "2", "3", "4", "5", "6", :verses, # extracts
:cp1, :cp2, :shape, :pos, :hpos, :vpos, :spos, :text, :style, :marks # tuplets annotations
],
].map{|i| i.to_s},
[]],
}
k = key.split(".").last

%Q{
"#{k}": #{JSON.neat_generate(conf[key], neatjson_options)}
}.split("\n").map { |l| " #{l}" }.join("\n")
}.split("\n").map {|l| " #{l}"}.join("\n")
end

a=ConfDocProvider.new

File.open(HELP_DE_INPUT).read.scan(/## ([^\n]*)([^#]*)/).sort_by{|i|i[0]}.each do |match|
File.open(HELP_DE_INPUT).read.scan(/## ([^\n]*)([^#]*)/).sort_by {|i| i[0]}.each do |match|
a.insert(match[0], match[1])
end

Expand All @@ -74,42 +100,41 @@ def get_example(conf, key)
$conf_helptext = a.entries_html

ignore_patterns = [/^neatjson.*/, /abc_parser.*/, /^extract\.[235].*/, /^defaults.*/, /^templates.*/, /^annotations.*/, /^extract\.[1234]/,
/^layout.*/, /^extract\.0$/, /^presets\.layout\..*$/
/^layout.*/, /^extract\.0$/, /^presets$/, /^presets\..*$/
]
produce_patterns = [/annotations\.vl/, /^templates\.tuplets/, /^extract$/, /^templates/, /^annotations/]
extra_keys = ['extract.0.notebound.minc', 'extract.0.notebound.minc.x.minc_f', "extract.0.notebound.tuplet"]
produce_patterns = [/annotations\.vl/, /^templates\.tuplets/, /^extract$/, /^templates/, /^annotations/, /^presets\.notes/]
extra_keys = ['extract.0.notebound.minc', 'extract.0.notebound.minc.x.minc_f', "extract.0.notebound.tuplet"]

locale = JSON.parse(File.read('../public/locale/de-de.json'))

$conf = Confstack.new(false)
$conf.push(JSON.parse(InitConf.init_conf.to_json))
$conf['presets.layout.layout_regular'] = nil # This is a lambda which needs to be suppressed for documentation
$conf['presets.layout.packer_regular'] = nil # This is a lambda which needs to be suppressed for documentation
$conf = Confstack.new(false)
$conf.push(InitConf.init_conf.stringify_keys)

ignore_keys = $conf.keys.select { |k| ignore_patterns.select { |ik| k.match(ik) }.count > 0 }
produce_keys = $conf.keys.select { |k| produce_patterns.select { |ik| k.match(ik) }.count > 0 }
show_keys = ($conf.keys - ignore_keys + produce_keys + extra_keys).uniq.sort_by { |k| k.gsub('templates', 'extract.0') }
ignore_keys = $conf.keys.select {|k| ignore_patterns.select {|ik| k.match(ik)}.count > 0}
produce_keys = $conf.keys.select {|k| produce_patterns.select {|ik| k.match(ik)}.count > 0}
show_keys = ($conf.keys - ignore_keys + produce_keys + extra_keys).uniq.sort_by {|k| k.gsub('templates', 'extract.0')}

mdhelp = []
show_keys.sort.each do |key|
show_key = key #.gsub(/^templates\.([a-z]+)(\.)/){|m| "extract.0.#{$1}.0."}

candidate_keys = I18n.get_candidate_keys(key)
candidates = candidate_keys.map { |c| a.entries_md[c.join('.')] }
candidates = candidate_keys.map {|c| a.entries_md[c.join('.')]}

helptext = candidates.compact.first || %Q{TODO: Helptext für #{key} einfügen }
keyparts = key.split(".")

#\\index{#{keyparts.last.gsub("_", "-")}}\\index{#{keyparts.join(",").gsub("_", "-")}}

require 'pry'

result = %Q{
## `#{show_key}` - #{locale['phrases'][key.split(".").last]} {##{show_key}}
#{helptext}
#{get_example($conf, key) rescue ""}
#{get_example($conf, key) rescue "... kein Beispiel verfügbar ..."}
}
mdhelp.push result
end
Expand Down Expand Up @@ -178,5 +203,5 @@ def get_example(conf, key)
end

File.open("x.locales.template", "w") do |f|
f.puts keys.sort.to_a.map { |v| %Q{"#{v}": "**--#{v}"} }.uniq.sort_by { |i| i.upcase }.join(",\n")
f.puts keys.sort.to_a.map {|v| %Q{"#{v}": "**--#{v}"}}.uniq.sort_by {|i| i.upcase}.join(",\n")
end
2 changes: 1 addition & 1 deletion 30_sources/SRC_Zupfnoter/src/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def render_tunepreview_callback
abc_text = @editor.get_abc_part
abc_text = abc_text.split("\n").map {|line|
result = line
result = result.gsub('~', ' ') if line.start_with? 'W:'
result = result. gsub(/(\\?)(~)/){|m| m[0]=='\\' ? m[1] : ' '} if line.start_with? 'W:'
result
}.join("\n")

Expand Down
2 changes: 1 addition & 1 deletion 30_sources/SRC_Zupfnoter/src/harpnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ def layout(music, beat_layout = nil, print_variant_nr = 0, page_format='A4')
text = lyric_text.join("\n")

if lyrics
verses = text.gsub("\t", " ").squeeze(" ").split(/\n\n+/).map {|i| i.gsub('~', " ")}
verses = text.gsub("\t", " ").squeeze(" ").split(/\n\n+/)
lyrics.delete("versepos")
lyrics.each do |key, entry|
pos = entry[:pos]
Expand Down
15 changes: 11 additions & 4 deletions 30_sources/SRC_Zupfnoter/src/init_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ module InitConf
# 5. update config-form.rb to attach a type
# 6. update user-interface.js to add the menu entries
# 7: update json schema in opal-ajv.rb

def self.cut_string_names(stringnames, from, to)
stringnames.split(' ').each_with_index.map{|v, index| index.between?(from, to) ? v : '~' }.join(' ')
end

def self.init_conf()



explicit_sort = [:produce, :annotations, :restposition, :default, :repeatstart, :repeatend, :extract,
:title, :filenamepart, :startpos, :voices, :flowlines, :subflowlines, :synchlines, :jumplines, :repeatsigns, :layoutlines, :barnumbers, :countnotes,
:legend, :nonflowrest, :lyrics, :notes, :tuplet, :layout, :printer,
Expand Down Expand Up @@ -145,7 +152,7 @@ def self.init_conf()
X_SPACING: lambda {$conf['extract.0.layout.X_SPACING']},
X_OFFSET: lambda {$conf['extract.0.layout.X_OFFSET']} # just to be safe
},
stringnames: {text: lambda {$conf['extract.0.stringnames.text']},
stringnames: {text: lambda {self.cut_string_names($conf['extract.0.stringnames.text'], 12, 36)},
marks: {hpos: lambda {$conf['extract.0.stringnames.marks.hpos']}
}
},
Expand All @@ -160,7 +167,7 @@ def self.init_conf()
X_SPACING: lambda {$conf['extract.0.layout.X_SPACING']},
X_OFFSET: 23
},
stringnames: {text: lambda {$conf['extract.0.stringnames.text']},
stringnames: {text: lambda {self.cut_string_names($conf['extract.0.stringnames.text'], 14, 34)},
marks: {hpos: [57, 77]
}
},
Expand All @@ -175,7 +182,7 @@ def self.init_conf()
X_SPACING: lambda {$conf['extract.0.layout.X_SPACING']},
X_OFFSET: 28.5
},
stringnames: {text: lambda {$conf['extract.0.stringnames.text']},
stringnames: {text: lambda {self.cut_string_names($conf['extract.0.stringnames.text'], 16, 33)},
marks: {hpos: [59, 76]}
},
printer: {a4_pages: [2],
Expand All @@ -189,7 +196,7 @@ def self.init_conf()
X_SPACING: 14.50,
X_OFFSET: 240
},
stringnames: {text: 'G C D E F G A B C D - - - - - -',
stringnames: {text: 'G C D E F G A B C D ~ ~ ~ ~ ~ ~ ~',
marks: {hpos: [55, 74]}
},
printer: {a4_pages: [2],
Expand Down
3 changes: 2 additions & 1 deletion 30_sources/SRC_Zupfnoter/src/pdf_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def draw_annotation(root)
@pdf.font_size = style[:font_size]
@pdf.font_style = style[:font_style]
# + style ... we shift it up by the fontsize converted from point to mm by mm_per_point
@pdf.text(root.center.first, root.center.last + style[:font_size] * mm_per_point, root.text)
text = root.text.gsub(/(\\?)(~)/){|m| puts m; m[0]=='\\' ? m[1] : ' '}
@pdf.text(root.center.first, root.center.last + style[:font_size] * mm_per_point, text)
end


Expand Down
2 changes: 1 addition & 1 deletion 30_sources/SRC_Zupfnoter/src/svg_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def draw_annotation(root)
# activate to debug the positioning of text
#@paper.rect(root.center.first, root.center.last, 20, 5, 0, {stroke: "red", fill: "none", "stroke-width" => "0.2"}) if $log.loglevel == :debug

text = root.text.gsub(/\ +\n/, "\n").gsub("\n\n", "\n \n") #
text = root.text.gsub(/\ +\n/, "\n").gsub("\n\n", "\n \n"). gsub(/(\\?)(~)/){|m| m[0]=='\\' ? m[1]: ' '}
attr = {}
attr[:"font-size"] = style[:font_size]/3 # literal by try and error
attr[:"font-family"] = "Arial"
Expand Down
2 changes: 1 addition & 1 deletion 30_sources/SRC_Zupfnoter/src/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = "1.7.0 dev 7"
VERSION = "1.7.0"
SCHEMA_VERSION = 'https://zupfnoter.weichel21.de/schema/zupfnoter-config_1.0.json'
COPYRIGHT = #{Time.now.year} https://www.zupfnoter.de"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Version 1.7.0 dev 7
Version 1.7.0

© 2017 https://www.zupfnoter.de

53 changes: 46 additions & 7 deletions 30_sources/UD_Zupfnoter-Handbuch/040_UD-Zupfnoter-Referenz.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ und das Einelgen in das Instrument zu vereinfachen:
> \ref{extract.0.stringnames}
> [extract.0.stringnames](#extract.0.stringnames)).
> **Hinweis**: Wenn einzelne Saiten nicht beschriftet werden sollen,
> kann als Saitenname eine Tilde ('\~) angegeben werden. Diese
> erscheint dann als festes Leerzeichen.
- **(38) marks - Saitenmarke** Die Saitenmarken sind eine Hilfe zum
korrekten Einlegen der Unterlegnoten in die Tischharfe. Das Blatt
muss so in die Tischharfe eingelegt werden, dass die Marken unter
Expand Down Expand Up @@ -1481,7 +1485,7 @@ zu bieten hat :-). Aber mit der Maus geht es ganz einfach:
> aufrufen und den Kontrollpunkt so ändern, dass er wireder sichtbar
> wird.
## Flußlinien gestalten
## Flußlinien gestalten {#flowconf}

Bei manchen Stücken kommt es vor, dass die Flußlinie einer Stimme durch
die Begleintnoten verläuft. In diemesm Fall muss man ggf. die Flußlinie
Expand Down Expand Up @@ -1810,13 +1814,48 @@ relevante Beispiele
> Bitte vermeide das, weil Zupfnoter dafür nicht ausgelegt ist und das
> Verhalten noch nicht ausgetestet ist.
### Wenn die vertikale Anodrnung optimiert werden soll
### Wenn die vertikale Anordnung optimiert werden soll

Zupfnoter errechnet die vertikale Anordnung der Noten selbständig und
erreicht auch gute Ergebnisse. In Grenzsituationen (z.B. bei langen
Stücken) ist eine manuelle Korrektur sinnvoll. Diese Optimierungen
sollten in folgender Reihenfolge ausgeführt werden.

1. in `extract.0.layoutlines` über die Grundeinstellungen eine `0`
eintragen. Diese führt dazu, dass nur noch die Stimmen, die auf dem
Blatt dargestellt werden, auch für die Berechnung vertikalen
Anordnung berücksichtigt werden. Damit entstehen keine scheinbar
unmotivierten Vorschübe.

2. Synchronisationslinien abschalten (das Feld im Edior löschen oder
'0-1' eintragen). Bei shr vollen Blättern verwirren die
Synchronisationslinene mehr als sie helfen.

3. im Konfigurationsmenü `Layout` mit den Schnelleinstellungen
`layout` `kompakt` bzw. `Packer` `kompakt` die beste Einstellung
suchen

4. ggf. gebundene Noten zu einer Note zusammenfassen

5. Den vertikalen Vorschub manuell steuern. Die Möglichkeiten dazu sind
in
Kapitel \ref{extract.0.notebound.minc} [`minc`](#extract.0.notebound.minc)
beschrieben.

6. Die Flußlinie gestalten (siehe Kapitel \ref{flowconf} [Flußlinien
gestalten](#flowconf))

### feste Leerzeichen in Texten

Zupfnoter wandelt eine Tilde ('\~') in Texten in feste Leerzeichen um.
Anwendungsfälle hierfür sind:

- Einrückungen in Liedtexten, so dass Noten ggf. in den Text ragen
können
- Besondere Saitenbeschriftungen, welche Leerzeichen enthalten sollen

Es kann vorkommen, dass man in das vertikale Layout eingreifen muss,
z.B. wennd ie Flussline einer Stimme durch eine Noten einer anderen
Stimme läüft. Die Möglichkeiten dazu sind in
Kapitel \ref{extract.0.notebound.minc} [`minc`](#extract.0.notebound.minc)
beschrieben.
> **Hinweis**: Sollte je doch eine Tilde benötigt werden kann diese mit
> maskiert werden, z.B. '`das\~ist`' ergibt '`das~ist`'.
### Extra Einstellungen für die Notenvorschau

Expand Down
Loading

0 comments on commit 0835408

Please sign in to comment.