Skip to content

Commit

Permalink
Merge branch 'release/1.7.0_dev-6'
Browse files Browse the repository at this point in the history
  • Loading branch information
bwl21 committed Aug 29, 2017
2 parents 3f0c1bc + b9a249c commit 8da9db9
Show file tree
Hide file tree
Showing 22 changed files with 926 additions and 726 deletions.
17 changes: 15 additions & 2 deletions 30_sources/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
* Config form is refreshed after loading another song (#156)
* printer offset is no longer broken if user enters only one value (#157)
* Dropbox-Path can now also have digits (#162)
* Printer window show pdf on Chrome 60 (#160)
* now invisible rests are supressed even on flowline (#166)
* now handle multi measure rests (#166)
* fix predefined annotations vt and vr
* BWC: move Tuplet configuration to notebounds (#168)


## enhancement
Expand All @@ -28,6 +33,11 @@
* now have variant parts appear in grey (#151)
* now menu supports extract 0 to extract 5 (#153)
* now menu also shows title of extracts (#153)
* ctrl-alt 'F' now toggles harp preview

## internal stuff

* updated to abc2svg 1.13.7 (#163)

## experimental feature

Expand All @@ -36,8 +46,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.
* BWC Default for "filenamepart" is now as it was in 1.5 (#155)
* layoutlines is now the combination of voices and layoutlines.
It is no longer possible to show voices without considering them in the layout.
* 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)

## known issues

Expand Down Expand Up @@ -91,6 +103,7 @@ Dragging of jumpline does not work properly on Saitenspiel #158
* in case of multiple `[P:]` respecitvly `[R:]` the now the last one is relevant - best to remove the other ones
* now get message if F: is missing
* now get messaage Filename or path contains whitespace and special characters
* you have to redo configuration for tuplets (#167 )

## known issues

Expand Down
Binary file modified 30_sources/SRC_Zupfnoter/public/UD_Zupfnoter-Handbuch-de_review.pdf
Binary file not shown.
10 changes: 5 additions & 5 deletions 30_sources/SRC_Zupfnoter/public/locale/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@
"Yes": "Ja",
"Yesterday": "Gestern",
"Your remote data source record count has changed, reloading from the first record.": "Die Datenquelle hat sich geändert, lade Daten ab erstem Eintrag neu.",
"flowline": "Melodieliniexxx",
"subflowline": "Hilfsmelodielinie",
"create": "erzeugen",
"---this-is-the -end": "",
"": "",
"-": "-",
"0": "0",
Expand Down Expand Up @@ -181,10 +179,11 @@
"could not find extract with number": "Es gibt keinen Auszug mit nummer",
"could not open file": "konnte Datei nicht öffnen",
"countnotes": "Zählmarken",
"cp1": "Kontrollpunkt 1",
"cp2": "Kontrollpunkt 2",
"cp1": "cp1",
"cp2": "cp2",
"Create new sheet": "Neues Blatt erstellen",
"Create new Sheet": "Neues Musikstück erstellen",
"create": "erzeugen",
"current extract": "aktueller Auszug",
"d1": "**--d1",
"d12": "**--d12",
Expand Down Expand Up @@ -258,6 +257,7 @@
"fit to viewport": "in Anzeigebereich\neinpassen",
"fit": "eingepasst",
"Flowline": "Flußlinie",
"flowline": "Flußlinie",
"flowlines": "Flußlinien",
"Folder in Dropbox": "Ordner in der Dropbox",
"followup distance": "Abstand der Folgelinie",
Expand Down
5 changes: 2 additions & 3 deletions 30_sources/SRC_Zupfnoter/src/abc2svg_to_harpnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,7 @@ def _transform_rest(voice_element, index, voice_index)

_transform_measure_start(voice_element)

the_note = voice_element[:notes].first
duration = _convert_duration(the_note[:dur])
duration = _convert_duration(voice_element[:dur])
tuplet, tuplet_end, tuplet_start = _parse_tuplet_info(voice_element)

result = Harpnotes::Music::Pause.new(pitch, duration)
Expand All @@ -554,7 +553,7 @@ def _transform_rest(voice_element, index, voice_index)
result.tuplet_start = tuplet_start
result.tuplet_end = tuplet_end

result.visible = false if voice_element[:invisible]
result.visible = false if voice_element[:invis]

# the post processing

Expand Down
4 changes: 3 additions & 1 deletion 30_sources/SRC_Zupfnoter/src/config-form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def self.to_neutral(key, string="")

def self.to_template(key)
# handle the case notes.x
template = key.split('.')[-2] # templates are for "extract.x.<template>"
template = key.split('.')[-2] # templates are for "extract....<template>.x"
voice_template = key.split('.')[-3] # templates are for "extract.<template>.v_<voice>.x"
a = $conf.get("templates.#{template}") if template
a = $conf.get("templates.#{voice_template}") unless a

unless a
help_key = key
Expand Down
7 changes: 7 additions & 0 deletions 30_sources/SRC_Zupfnoter/src/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def initialize
$conf.strict = false
$conf.push(_init_conf)

$settings = {} # this is te keep runtime settings

@json_validator = Ajv::JsonValidator.new

@editor = Harpnotes::TextPane.new("abcEditor")
Expand Down Expand Up @@ -986,6 +988,11 @@ def setup_ui_listener
when 'K'.ord #k
e.prevent
toggle_console
when 'F'.ord
if e.alt_key
e.prevent
%x{#{@zupfnoter_ui}.toggle_full_screen();}
end
end
end
end
Expand Down
29 changes: 26 additions & 3 deletions 30_sources/SRC_Zupfnoter/src/controller_command_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,29 @@ def __ic_03_create_commands
end
end

@commands.add_command(:setsetting) do |command|
command.undoable = false

command.add_parameter(:key, :string) do |parameter|
parameter.set_help {"parameter key"}
end

command.add_parameter(:value, :string) do |parameter|
parameter.set_help {"parameter value as JSON"}
end

command.set_help {"adjust settings (runtime only setting) parameter"}

command.as_action do |args|
$settings[args[:key]] = args[:value]
nil
end

command.as_inverse do |args|
end
end



@commands.add_command(:addconf) do |command|
command.undoable = false
Expand Down Expand Up @@ -477,7 +500,7 @@ def expand_extractnumbering(keys)
annotations: {keys: [:annotations], newentry_handler: lambda {handle_command("addconf annotations")}},
notes: {keys: expand_extract_keys([:notes]), newentry_handler: lambda {handle_command("addconf notes")}, quicksetting_commands: _get_quicksetting_commands('notes')},
lyrics: {keys: expand_extract_keys([:lyrics]), newentry_handler: lambda {handle_command("addconf lyrics")}},
minc: {keys: expand_extract_keys(['layout.minc'])},
minc: {keys: expand_extract_keys(['notebound.minc'])},
layout: {keys: expand_extract_keys([:layout, 'layout.limit_a3']), quicksetting_commands: _get_quicksetting_commands('layout')},
printer: {keys: expand_extract_keys([:printer, 'layout.limit_a3']), quicksetting_commands: _get_quicksetting_commands('printer')},

Expand All @@ -499,7 +522,7 @@ def expand_extractnumbering(keys)
# it is useful for extracts, notes, morincs etc.
# todo: implement a more flexible replacement thatn simply prefixing
regexp_form_sets = {
/extract.(\d+).layout.minc\.(\d+)/ => {keys: ["minc_f"]}
/extract.(\d+).notebound.minc\.(\d+)/ => {keys: ["minc_f"]}
}

# see if we have a static form set
Expand Down Expand Up @@ -602,7 +625,7 @@ def expand_extractnumbering(keys)

@commands.add_command(:addsnippet) do |command|
command.undoable = false
command.set_help {"edit current snippet"}
command.set_help {"add current snippet"}

command.add_parameter(:token, :string) do |parameter|
parameter.set_help {"parameter key"}
Expand Down
55 changes: 45 additions & 10 deletions 30_sources/SRC_Zupfnoter/src/harpnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ def initialize
@slur_index = {}
@y_offset = 5
@conf_beat_resolution = $conf.get('layout.BEAT_RESOLUTION')
@layout_minc = $conf.get('layout.minc')
@layout_minc = {} # this is the lookup table for minc; it is populated in Default.layout
@color_default = $conf.get('layout.color.color_default')
@color_variant1 = $conf.get('layout.color.color_variant1')
@color_variant2 = $conf.get('layout.color.color_variant2')
Expand All @@ -1177,7 +1177,7 @@ def set_instrument_handlers

xoffset = $conf['layout.X_OFFSET']
xspacing = $conf['layout.X_SPACING']
pitchoffset = $conf.get('layout.PITCH_OFFSET')
pitchoffset = $conf.get('layout.PITCH_OFFSET')
@bottom_annotation_positions = [[150, 289], [325, 289], [380, 289]]
@pitch_to_xpos = lambda {|pitch| (pitchoffset + pitch) * xspacing + xoffset}

Expand Down Expand Up @@ -1283,6 +1283,8 @@ def layout(music, beat_layout = nil, print_variant_nr = 0, page_format='A4')

initialize

@layout_minc = print_options_raw['notebound.minc'] || {}

@y_offset = print_options_hash[:startpos]

beat_compression_map = nil
Expand Down Expand Up @@ -1553,7 +1555,7 @@ def layout_voice(voice, beat_layout, print_variant_nr, show_options)

# turn previous note visible if the current playable is visible but not synchronized
# which in turn means that it is part of a subflowline
if c.visible and not show_options[:synched_notes].include?(c.proxy_note)
if not show_options[:flowline] and c.visible and not show_options[:synched_notes].include?(c.proxy_note)
previous_note.visible = true unless previous_note.nil? # this handles the very first note which has previous_note
end
previous_note = c
Expand All @@ -1570,7 +1572,7 @@ def layout_voice(voice, beat_layout, print_variant_nr, show_options)
res_decorations.push (playable.decorations.empty? ? [] : make_decorations_per_playable(playable, decoration_root, print_variant_nr, show_options, voice_nr))

# todo: this also adds the manual incrementation conf_key. This should be separated as another concern
decoration_root.conf_key = %Q{extract.#{print_variant_nr}.layout.minc.#{playable.time}.minc_f}
decoration_root.conf_key = %Q{extract.#{print_variant_nr}.notebound.minc.#{playable.time}.minc_f}

[result]
end.flatten.compact
Expand Down Expand Up @@ -1684,11 +1686,44 @@ def layout_voice(voice, beat_layout, print_variant_nr, show_options)
end

# draw the flowlines
previous_note = nil
res_flow = voice.select {|c| c.is_a? Playable}.map do |playable|
previous_note = nil
do_flowconf = $settings["flowconf"] == 'edit' # this parameter turns flowconfiguraiton on/off
default_tuplet_options = $conf['defaults.notebound.flowline']
flowlines_conf_key = "notebound.flowline.v_#{voice_nr}"
flowlines_conf = show_options[:print_options_raw][flowlines_conf_key] || {} # here we cache the configuration of flowlines

res_flow = voice.select {|c| c.is_a? Playable}.map do |playable|
res = nil
unless previous_note.nil?
res = FlowLine.new(lookuptable_drawing_by_playable[previous_note], lookuptable_drawing_by_playable[playable])
# todo: remove this if clause or set to fals to turn flowline configuration off at all
if true # do_flowconf == true
flowline_conf_key = "#{playable.znid}"
conf_from_options = flowlines_conf[flowline_conf_key]
if conf_from_options or do_flowconf == true
conf_key = "extract.#{print_variant_nr}.#{flowlines_conf_key}.#{flowline_conf_key}"
conf_key_edit = conf_key + ".*" # "Edit conf strips the last element of conf_key"

p1 = Vector2d(lookuptable_drawing_by_playable[previous_note].center)
p2 = Vector2d(lookuptable_drawing_by_playable[playable].center)

## note we use the name tuplet_options since we steal the code from tuplet - handling
tuplet_options = Confstack.new()
tuplet_options.push(default_tuplet_options)
tuplet_options.push(conf_from_options) rescue nil

tiepath, bezier_anchor, cp1, cp2 = make_annotated_bezier_path([p1, p2], tuplet_options)

if do_flowconf == true
draginfo = {handler: :tuplet, p1: p1, p2: p2, cp1: cp1, cp2: cp2, mp: bezier_anchor, tuplet_options: tuplet_options, conf_key: conf_key, callback: nil}
else
draginfo = nil
end
res = Harpnotes::Drawing::Path.new(tiepath).tap {|d| d.conf_key = conf_key_edit; d.draginfo = draginfo}

end
end

res = FlowLine.new(lookuptable_drawing_by_playable[previous_note], lookuptable_drawing_by_playable[playable]) unless res
#res.color = compute_color_by_variant_no(playable.variant) # todo: uncomment to colorize flowlines
res.line_width = $conf.get('layout.LINE_MEDIUM');
res = nil unless previous_note.visible? # interupt flowing if one of the ends is not visible
Expand Down Expand Up @@ -1740,7 +1775,7 @@ def layout_voice(voice, beat_layout, print_variant_nr, show_options)
tuplet_notes.push playable.time if tuplet_start

if playable.tuplet_end?
tuplet_conf_key = "tuplet.#{tuplet_start.znid}"
tuplet_conf_key = "notebound.tuplet.v_#{voice_nr}.#{tuplet_start.znid}" # "tuplet.#{tuplet_start.znid}"
conf_key = "extract.#{print_variant_nr}.#{tuplet_conf_key}"
conf_key_pos = 'pos'

Expand Down Expand Up @@ -1936,8 +1971,8 @@ def make_decorations_per_playable(playable, decoration_root, print_variant_nr, s

decoration_center = [decoration_root.center.first + annotationoffset.first, decoration_root.center.last + annotationoffset.last]
r = Harpnotes::Drawing::Glyph.new(decoration_center, decoration_size, decoration, false, nil, conf_key, annotationoffset)
r.tap { |s| s.draginfo={handler: :annotation} }
r.is_note = false
r.tap {|s| s.draginfo={handler: :annotation}}
r.is_note = false
decoration_result.push [r]
end
end
Expand Down
16 changes: 11 additions & 5 deletions 30_sources/SRC_Zupfnoter/src/init_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ def self.init_conf()
:title, :filenamepart, :startpos, :voices, :flowlines, :subflowlines, :synchlines, :jumplines, :repeatsigns, :layoutlines, :barnumbers, :countnotes,
:legend, :nonflowrest, :lyrics, :notes, :tuplet, :layout, :printer,
#
:annotation, :partname, :variantend, :countnotes, :stringnames, # sort within notebound
:annotation, :decoration, :partname, :variantend, :countnotes, :c_jumplines, :tuplet, :minc, :flowline, # sort within notebound

:stringnames,

# sort within layout
:limit_a3, :jumplineoffset, :LINE_THIN, :LINE_MEDIUM, :LINE_THICK, :ELLIPSE_SIZE, :REST_SIZE,
:DRAWING_AREA_SIZE,
:instrument, :packer, :pack_method, :pack_max_spreadfactor, :pack_min_increment,
:sortmark, :show, :fill, :size,
:minc,
# sort within printer
:a3_offset, :a4_offset, :a4_pages, # sort within laoyut

Expand Down Expand Up @@ -48,6 +49,12 @@ def self.init_conf()
cp2: [5, -2], # second control point
shape: ['c'], # 'c' | 'l' => curve | line
show: true
},
flowline: {
cp1: [0, 10], # first control point positive x: point is east of flowline, positive y: point is south of note
cp2: [0, -10], # second control point
shape: ['c'], # 'c' | 'l' => curve | line
show: true
}
}
},
Expand Down Expand Up @@ -255,8 +262,8 @@ def self.init_conf()
# these are the builtin notebound annotations
annotations: {
vl: {text: "v", pos: [-5, -5]},
vt: {text: "v", pos: [2, -5]},
vr: {text: "v", pos: [-1, -5]}
vt: {text: "v", pos: [-1, -5]},
vr: {text: "v", pos: [2, -5]}
}, # default for note based annotations

extract: {
Expand Down Expand Up @@ -291,7 +298,6 @@ def self.init_conf()
ELLIPSE_SIZE: [3.5, 1.7], # radii of the largest Ellipse
REST_SIZE: [4, 2],
DRAWING_AREA_SIZE: [400, 282],
minc: {}, # moreinc
instrument: '37-strings-g-g',
packer: {
pack_method: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"could not find extract with number": "Es gibt keinen Auszug mit nummer",
"could not open file": "konnte Datei nicht öffnen",
"countnotes": "Zählmarken",
"cp1": "Kontrollpunkt 1",
"cp2": "Kontrollpunkt 2",
"cp1": "cp1",
"cp2": "cp2",
"Create new sheet": "Neues Blatt erstellen",
"Create new Sheet": "Neues Musikstück erstellen",
"create": "erzeugen",
Expand Down Expand Up @@ -150,6 +150,7 @@
"fit to viewport":"in Anzeigebereich\neinpassen",
"fit" : "eingepasst",
"Flowline": "Flußlinie",
"flowline": "Flußlinie",
"flowlines": "Flußlinien",
"Folder in Dropbox": "Ordner in der Dropbox",
"followup distance": "Abstand der Folgelinie",
Expand Down
Loading

0 comments on commit 8da9db9

Please sign in to comment.