-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunabc.tcl
executable file
·27494 lines (24230 loc) · 936 KB
/
runabc.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#package provide app-runabc 1.0
#!/bin/sh
# the next line restarts using wish \
exec wish8.6 "$0" "$@"
#
# runabc.tcl - by Seymour Shlien [email protected]
# This is graphics user interface to the abc2midi and abc2ps programs.
# This script and the above programs are public domain.
#
# runabc.tcl: a graphical user interface to abcMIDI and other packages
#
# Copyright (C) 1998-2025 Seymour Shlien
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Original page:
# http://ifdo.ca/~seymour/runabc/top.html
set runabc_version 2.364
set runabc_date "(December 25 2024 15:15)"
set runabc_title "runabc $runabc_version $runabc_date"
set tcl_version [info tclversion]
set startload [clock clicks -milliseconds]
#lappend auto_path /usr/share/tcltk/tk8.5
package require Tk
if {[catch {package require Ttk} error]} {
puts $error
puts "I am looking for this package in $auto_path"
puts "Be sure you are running Tcl/Tk 8.5 or higher"
}
# Part 1.0 Tooltip
# Part 2.0 Start up
# Part 3.0 images
# Part 4.0 Control Buttons
# Part 5.0 TOC
# Part 6.0 Core Functions
# Part 7.0 TOC creator
# Part 8.0 Extract Tune
# Part 9.0 Functions for Manipulating abc tune file
# Part 10.0 Abc Editor Functions
# Part 10.1 Bar Picker
# Part 10.2 Guitar Chord ToolBox
# Part 10.3 Transposition ToolBox
# Part 10.4 Note Length ToolBox
# Part 10.5 Editor Clean Functions
# Part 10.6 Process Editor Buffer
# Part 10.7 Grace Notes Toolbox
# Part 10.8 Chords ToolBox
# Part 11.0 Show Summary Sheet ,tmpfile and message sheet
# Part 12.0 Property Sheets -- titles, voice, style, abc2abc, midi2abc etc
# Part 13.0 Help texts
# Part 14.0 Drum Editor
# Part 15.0 Title Search functions
# Part 16.0 Abcmatcher interface
# Part 17.0 Grouper interface
# Part 18.0 Diagnostic Support Functions
# Part 19.0 Abc Editor Filter functions
# Part 20.0 Bar Alignment
# Part 21.0 Console Page Support Functions
# Part 22.0 Midi2abc interface
# Part 23.0 Voice Support Functions for midi2abc
# Part 24.0 Chord substitution functions for Abc Editor
# Part 25.0 Midishow - Piano Roll
# Part 26.0 Midi Drum event viewer (drumgram)
# Part 27.0 Midi Statistics for Midishow
# Part 28.0 Graphics Namespace
# Part 29.0 File type registration
# Part 30.0 Mftext interface
# Part 31.0 Incipits file support functions
# Part 32.0 Beat Graph and Unique Chords for Midishow
# Part 33.0 Solfege vocalization for abc editor
# Part 34.0 Drum Editor
# Part 35.0 Gchord to voice
# Part 36.0 Drum to voice
# Part 37.0 Refactor, gchordsOnly
# Part 38.0 Mode Recognition
# Part 39.0 Advanced abcm2ps support
# Part 40.0 Live Editor
# Part 41.0 Generate Guitar Chords
# Part 42.0 Midisummary
# Part 43.0 Notegram
# Part 44.0 Midistructure
# Part 45.0 big abc editor
# Part 46.0 pgram
# Part 47.0 chordgram
# Part 48.0 get_geometry_of_all_toplevels
# Important global variables:
# midi() -- array storing states in runabc.ini
# df font
# abc_open file name path of input abc file
# active_sheet property sheet overlain on main window
# exec_out passes output messages from executables
# fileseek byte position of each tune in abc file
# keyorder CDEFGAB
# keymap flat and sharps map
# gchordtypes aug dim maj7 etc.
# m(1)-m(16) names of 128 Midi programs
# progtranslator names of 128 Midi programs
# drumpatches names of percussion instruments
# note(0)-(11) C C# D etc.
# drumentry drum pattern
# mididrum preserved drum pattern for meter
# gchordentry gchord for tune
# midigchord preserved gchord pattern for meter
# dvoice for g2v (gchords/drums to voices)
# modifiedflag live editor modified
# Graphical User Interface
# Part 1.0 Tooltip
# tooltip.tcl --
#
# Balloon help
#
# Copyright (c) 1996-2003 Jeffrey Hobbs
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: tooltip.tcl,v 1.5 2005/11/22 00:55:07 hobbs Exp $
#
# Initiated: 28 October 1996
package require Tk 8.5
package provide tooltip 1.1
#------------------------------------------------------------------------
# PROCEDURE
# tooltip::tooltip
#
# DESCRIPTION
# Implements a tooltip (balloon help) system
#
# ARGUMENTS
# tooltip <option> ?arg?
#
# clear ?pattern?
# Stops the specified widgets (defaults to all) from showing tooltips
#
# delay ?millisecs?
# Query or set the delay. The delay is in milliseconds and must
# be at least 50. Returns the delay.
#
# disable OR off
# Disables all tooltips.
#
# enable OR on
# Enables tooltips for defined widgets.
#
# <widget> ?-index index? ?-item id? ?message?
# If -index is specified, then <widget> is assumed to be a menu
# and the index represents what index into the menu (either the
# numerical index or the label) to associate the tooltip message with.
# Tooltips do not appear for disabled menu items.
# If message is {}, then the tooltip for that widget is removed.
# The widget must exist prior to calling tooltip. The current
# tooltip message for <widget> is returned, if any.
#
# RETURNS: varies (see methods above)
#
# NAMESPACE & STATE
# The namespace tooltip is used.
# Control toplevel name via ::tooltip::wname.
#
# EXAMPLE USAGE:
# tooltip .button "A Button"
# tooltip .menu -index "Load" "Loads a file"
#
#------------------------------------------------------------------------
namespace eval ::tooltip {
namespace export -clear tooltip
variable tooltip
variable G
array set G {
enabled 1
DELAY 500
AFTERID {}
LAST -1
TOPLEVEL .__tooltip__
}
# The extra ::hide call in <Enter> is necessary to catch moving to
# child widgets where the <Leave> event won't be generated
bind Tooltip <Enter> [namespace code {
#tooltip::hide
variable tooltip
variable G
set G(LAST) -1
if {$G(enabled) && [info exists tooltip(%W)]} {
set G(AFTERID) \
[after $G(DELAY) [namespace code [list show %W $tooltip(%W) cursor]]]
}
}]
bind Menu <<MenuSelect>> [namespace code { menuMotion %W }]
bind Tooltip <Leave> [namespace code hide]
bind Tooltip <Any-KeyPress> [namespace code hide]
bind Tooltip <Any-Button> [namespace code hide]
}
proc ::tooltip::tooltip {w args} {
variable tooltip
variable G
switch -- $w {
clear {
if {[llength $args]==0} { set args .* }
clear $args
}
delay {
if {[llength $args]} {
if {![string is integer -strict $args] || $args<50} {
return -code error "tooltip delay must be an\
integer greater than 50 (delay is in millisecs)"
}
return [set G(DELAY) $args]
} else {
return $G(DELAY)
}
}
off - disable {
set G(enabled) 0
hide
}
on - enable {
set G(enabled) 1
}
default {
set i $w
if {[llength $args]} {
set i [uplevel 1 [namespace code "register [list $w] $args"]]
}
set b $G(TOPLEVEL)
if {![winfo exists $b]} {
toplevel $b -class Tooltip
if {[tk windowingsystem] eq "aqua"} {
::tk::unsupported::MacWindowStyle style $b help none
} else {
wm overrideredirect $b 1
}
wm positionfrom $b program
wm withdraw $b
label $b.label -highlightthickness 0 -relief solid -bd 1 \
-background lightyellow -fg black
pack $b.label -ipadx 1
}
if {[info exists tooltip($i)]} { return $tooltip($i) }
}
}
}
proc ::tooltip::register {w args} {
variable tooltip
set key [lindex $args 0]
while {[string match -* $key]} {
switch -- $key {
-index {
if {[catch {$w entrycget 1 -label}]} {
return -code error "widget \"$w\" does not seem to be a\
menu, which is required for the -index switch"
}
set index [lindex $args 1]
set args [lreplace $args 0 1]
}
-item {
set namedItem [lindex $args 1]
if {[catch {$w find withtag $namedItem} item]} {
return -code error "widget \"$w\" is not a canvas, or item\
\"$namedItem\" does not exist in the canvas"
}
if {[llength $item] > 1} {
return -code error "item \"$namedItem\" specifies more\
than one item on the canvas"
}
set args [lreplace $args 0 1]
}
default {
return -code error "unknown option \"$key\":\
should be -index or -item"
}
}
set key [lindex $args 0]
}
if {[llength $args] != 1} {
return -code error "wrong \# args: should be \"tooltip widget\
?-index index? ?-item item? message\""
}
if {$key eq ""} {
clear $w
} else {
if {![winfo exists $w]} {
return -code error "bad window path name \"$w\""
}
if {[info exists index]} {
set tooltip($w,$index) $key
#bindtags $w [linsert [bindtags $w] end "TooltipMenu"]
return $w,$index
} elseif {[info exists item]} {
set tooltip($w,$item) $key
#bindtags $w [linsert [bindtags $w] end "TooltipCanvas"]
enableCanvas $w $item
return $w,$item
} else {
set tooltip($w) $key
bindtags $w [linsert [bindtags $w] end "Tooltip"]
return $w
}
}
}
proc ::tooltip::clear {{pattern .*}} {
variable tooltip
foreach w [array names tooltip $pattern] {
unset tooltip($w)
if {[winfo exists $w]} {
set tags [bindtags $w]
if {[set i [lsearch -exact $tags "Tooltip"]] != -1} {
bindtags $w [lreplace $tags $i $i]
}
## We don't remove TooltipMenu because there
## might be other indices that use it
}
}
}
proc ::tooltip::show {w msg {i {}}} {
# Use string match to allow that the help will be shown when
# the pointer is in any child of the desired widget
if {![winfo exists $w] || ![string match $w* [eval [list winfo containing] [winfo pointerxy $w]]]} {
return
}
variable G
set b $G(TOPLEVEL)
$b.label configure -text $msg
update idletasks
if {$i eq "cursor"} {
set y [expr {[winfo pointery $w]+20}]
if {($y+[winfo reqheight $b])>[winfo screenheight $w]} {
set y [expr {[winfo pointery $w]-[winfo reqheight $b]-5}]
}
} elseif {$i ne ""} {
set y [expr {[winfo rooty $w]+[winfo vrooty $w]+[$w yposition $i]+25}]
if {($y+[winfo reqheight $b])>[winfo screenheight $w]} {
# show above if we would be offscreen
set y [expr {[winfo rooty $w]+[$w yposition $i]-\
[winfo reqheight $b]-5}]
}
} else {
set y [expr {[winfo rooty $w]+[winfo vrooty $w]+[winfo height $w]+5}]
if {($y+[winfo reqheight $b])>[winfo screenheight $w]} {
# show above if we would be offscreen
set y [expr {[winfo rooty $w]-[winfo reqheight $b]-5}]
}
}
if {$i eq "cursor"} {
set x [winfo pointerx $w]
} else {
set x [expr {[winfo rootx $w]+[winfo vrootx $w]+\
([winfo width $w]-[winfo reqwidth $b])/2}]
}
# only readjust when we would appear right on the screen edge
if {$x<0 && ($x+[winfo reqwidth $b])>0} {
set x 0
} elseif {($x+[winfo reqwidth $b])>[winfo screenwidth $w]} {
set x [expr {[winfo screenwidth $w]-[winfo reqwidth $b]}]
}
if {[tk windowingsystem] eq "aqua"} {
set focus [focus]
}
wm geometry $b +$x+$y
wm deiconify $b
raise $b
if {[tk windowingsystem] eq "aqua" && $focus ne ""} {
# Aqua's help window steals focus on display
after idle [list focus -force $focus]
}
}
proc ::tooltip::menuMotion {w} {
variable G
if {$G(enabled)} {
variable tooltip
set cur [$w index active]
# The next two lines (all uses of LAST) are necessary until the
# <<MenuSelect>> event is properly coded for Unix/(Windows)?
if {$cur == $G(LAST)} return
set G(LAST) $cur
# a little inlining - this is :hide
after cancel $G(AFTERID)
catch {wm withdraw $G(TOPLEVEL)}
if {[info exists tooltip($w,$cur)] || \
(![catch {$w entrycget $cur -label} cur] && \
[info exists tooltip($w,$cur)])} {
set G(AFTERID) [after $G(DELAY) \
[namespace code [list show $w $tooltip($w,$cur) $cur]]]
}
}
}
proc ::tooltip::hide {args} {
variable G
after cancel $G(AFTERID)
catch {wm withdraw $G(TOPLEVEL)}
}
proc ::tooltip::wname {{w {}}} {
variable G
if {[llength [info level 0]] > 1} {
# $w specified
if {$w ne $G(TOPLEVEL)} {
hide
destroy $G(TOPLEVEL)
set G(TOPLEVEL) $w
}
}
return $G(TOPLEVEL)
}
proc ::tooltip::itemTip {w args} {
variable tooltip
variable G
set G(LAST) -1
set item [$w find withtag current]
if {$G(enabled) && [info exists tooltip($w,$item)]} {
set G(AFTERID) [after $G(DELAY) \
[namespace code [list show $w $tooltip($w,$item) cursor]]]
}
}
proc ::tooltip::enableCanvas {w args} {
$w bind all <Enter> [namespace code [list itemTip $w]]
$w bind all <Leave> [namespace code hide]
$w bind all <Any-KeyPress> [namespace code hide]
$w bind all <Any-Button> [namespace code hide]
}
# Part 2.0 Start up
proc position_window {window} {
global midi
if {[string length $midi($window)] < 1} return
if {$midi(autoposition) == 0} return
set n [scan $midi($window) "%dx%d+%d+%d" w h x y]
if {$n < 4} return
set geom $midi($window)
if {![string match $window ".notice"]} {
set geom "+$x+$y"
}
wm geometry $window $geom
}
wm protocol . WM_DELETE_WINDOW {
if {[winfo exist .live]} {
if {[.live.main.editor.t edit modified]} {
update_wholefile "no"}
}
get_geometry_of_all_toplevels
confirm_save
write_runabc_ini $runabcpath
exit
}
wm resizable . 1 1
global df
global ps_numb_start # used by display_section
global abc_file_mod
set abc_file_mod 0; # flag indicate that file midi(abc_open) was changed
# the user can pass as argument the .abc file to open
if {$argc == 1} {
set filename [file normalize [lindex $argv 0]]
# puts $filename
set abc_open $filename
}
# For abc files associated with runabc on Windows PC
# we need the following
if {$argc == 2} {
set abc_open [file normalize [lindex $argv 1]]
}
# Avoid multiple runabc processes, use DDE to find if another
# instance of runabc is running
if {$tcl_platform(platform) == "windows"} {
# get DDE support if available, if not keep going
if {![catch {package require dde}]} {
# Now check if runabc is already running: as you can see in the
# else case below if we don't find an active 'runabc' topic
# for 'TclEval' service we will start the DDE service and proceed.
if {[dde services TclEval runabc] != {}} {
# runabc was started earlier so this process asks the
# existing (previous) process to call 'open_abc_file'
# (only if it is a valid file)
if {[info exist abc_open] && [file exists $abc_open]} {
# send a message to open the .abc file,
# take care of special chars
regsub {\[} [set abc_open] {\[} abc_open
dde eval runabc "open_abc_file \"$abc_open\""
}
# Now we can terminate the new process, the previous will
# open the file for us and we avoid race conditions on .ini
# /temp and /workfolder
exit 0
} else {
# We did not find an instance of runabc running, so
# we register this as the 'runabc' topic and proceed
dde servername runabc
}
}
}
proc messages {msg} {
global df
if {[winfo exists .msg] != 0} {destroy .msg}
toplevel .msg
position_window ".msg"
message .msg.out -text $msg -font $df -width 300
pack .msg.out
}
proc greetings {msg} {
global df midi
if {[winfo exists .greetings] != 0} {destroy .greetings}
toplevel .greetings -width 400
wm title .greetings Welcome
position_window ".greetings"
message .greetings.out -text $msg -font $df -width 400
pack .greetings.out
checkbutton .greetings.switch -text "do not show this message next time" -variable midi(donotshow) -font $df
pack .greetings.switch
}
proc check_integrity {} {
global midi tcl_platform
global execpath runabcpath
set prtmsg 0
set msg ""
if {$tcl_platform(platform) == "windows"} {
set msg "You are running runabc.tcl under the Windows operating system.\n"
} else {
set msg "You are running runabc.tcl under the Unix operating system.\n"
}
append msg "runabc is running from $execpath\n"
append msg "runabc created the folders $runabcpath and this is where it\
will store internal files it needs to read and write. In particular, runabc.ini is found there.\n"
set abcmidi 0
set result [check_file path_abc2midi]
if {[string first "not found" $result] >= 0} {
append msg "abc2midi was not found at: $midi(path_abc2midi) \n"
set abcmidi 1
}
set result [check_file path_abc2abc]
if {[string first "not found" $result] >= 0} {
append msg "abc2abc was not found at: $midi(path_abc2abc) \n"
set abcmidi 1
}
set result [check_file path_midi2abc]
if {[string first "not found" $result] >= 0} {
append msg "midi2abc was not found at: $midi(path_midi2abc) \n"
set abcmidi 1
}
set result [check_file path_yaps]
if {[string first "not found" $result] >= 0} {
append msg "yaps was not found at: $midi(path_yaps) \n"
set abcmidi 1
}
set result [check_file path_abcmatch]
if {[string first "not found" $result] >= 0} {
append msg "abcmatch was not found at: $midi(path_abcmatch) \n"
set abcmidi 1
}
set result [check_file path_midicopy]
if {[string first "not found" $result] >= 0} {
append msg "midicopy was not found at: $midi(path_midicopy) \n"
set abcmidi 1
}
set result [check_file path_gs]
if {[string first "not found" $result] >= 0} {
append msg "ghostscript was not found at: $midi(path_gs) \n"
set abcmidi 1
}
if {$abcmidi == 1 && $tcl_platform(platform) == "windows"} {
append msg "\nYou can find the abcmidi_win32 executables for windows on\
http://ifdo.ca/~seymour/runabc/top.html\n\
You should put these executables in the same folder where runabc is found.\
If the executables are in a different folder you need to specify their location\
by going to the 'Options/ABC executables' menu item (wrench icon).\n"
set result [check_file path_abcm2ps]
if {[string first "not found" $result] >= 0} {
append msg "\nabcm2ps was not found at $midi(path_abcm2ps) \n"
append msg "\nIt is recommended that you use abcm2ps rather than yaps.\
abcm2ps is also included with the abcmidi_win32 executables that you can\
download from http://ifdo.ca/~seymour/runabc/top.html.\n"
}
if {[file exist "c:/Program Files/gs/"] != 1} {
set prtmsg 1
append msg " You will also need Ghostscript which you can get from http://www.cs.wisc.edu/~ghost/index.htm\n\
This should create a folder gs in your c:/program files/ directory."
}
if {$prtmsg} {append msg "I am configuring abcm2ps to output an xthml file instead of a postscript file."
set midi(m2ps_output) "xhtml"
}
} else {
if {$abcmidi == 1} {append msg "\nIf the abcmidi executables are\
already on your system, then you need to indicate their location by\
going to the 'Options/ABC executables' menu item (wrench icon) and specifying\
their location. If you do not have the executables, you will need to\
build them from the source code which you can find on\
http://ifdo.ca/~seymour/runabc/top.html or on sourceforge.net.\n"}
set result [check_file path_abcm2ps]
if {[string first "not found" $result] >= 0} {
append msg "\nabcm2ps was not found at $midi(path_abcm2ps) \n"
append msg "\nIt is recommended that you use abcm2ps rather than yaps.\
Source code for abcm2ps may be found on the web page http://moinejf.free.fr/ \
Either the stable or development versions are fine."
}
set result [check_file path_gs]
if {[string first "not found" $result] >= 0} {
append msg "\n$midi(path_gs) was not found\n\n"
append msg "\nYou will need to install ghostscript so that the live\
editor will work."
}
set result [check_file path_midiplayer_1]
if {[string first "not found" $result] >= 0} {
append msg "\n\nThe Midi file player was not found at $midi(path_midiplayer_1)\n"
append msg "\nYou also need a midi player like TiMidity. The\
quality of the reproduction depends upon the SoundFont pages it uses.\
Free soundfont files are available from http://www.personalcopy.com/sfarkfonts1.htm."
}
}
greetings $msg
}
proc check_file {execname} {
global midi tcl_platform
if {[file exist $midi($execname)]} {
set msg [format "found"]
} elseif {$tcl_platform(platform) != "windows"} {
set cmd "exec which $midi($execname)"
catch {eval $cmd} loc
if {[string first "abnorm" $loc] > 0} {set msg [format "not found"]} else {
set msg [format "found"]}} else {
set msg [format "not found"]}
return $msg
}
# default values for options
proc midi_init {} {
global midi df sf dfreset tocf
global runabc_version
global tcl_platform
global drumentry
global env
global runabcpath
set drumentry "none"
set midi(version) $runabc_version
set midi(font_family) [font actual helvetica -family]
set midi(font_family_toc) courier
#set midi(font_size) [font actual . -size]
set midi(font_size) 10
set midi(encoder) [encoding system]
if {$midi(font_size) <10} {set midi(font_size) 10}
#set midi(font_weight) [font actual . -weight]
set midi(font_weight) bold
set df [font create -family $midi(font_family) -size $midi(font_size) \
-weight $midi(font_weight)]
set sf [font create -family $midi(font_family) -size $midi(font_size) \
-weight $midi(font_weight)]
set dfreset [font create -family $midi(font_family) -size $midi(font_size) \
-weight $midi(font_weight)]
set tocf [font create -family $midi(font_family_toc) -size $midi(font_size) \
-weight $midi(font_weight)]
set midi(dir_abcmidi) .
#set midi(path_abc2ps) abc2ps deprecated
set midi(path_yaps) yaps
set midi(path_otherps) jcabc2ps
if {$tcl_platform(platform) == "windows"} {
set midi(path_yaps) yaps.exe
set midi(path_abcm2ps) abcm2ps.exe
set midi(path_abcmatch) abcmatch.exe
set midi(path_abc2midi) abc2midi.exe
set midi(path_abc2abc) abc2abc.exe
set midi(path_midi2abc) midi2abc.exe
set midi(path_midicopy) midicopy.exe
set midi(path_gs) ""
set midi(path_midiplayer_1) "C:/Program Files/Windows Media Player/wmplayer.exe"
set midi(path_midiplayer_2) "C:/Program Files (x86)/Winamp/Winamp.exe"
set midi(path_midiplayer_3) ""
set midi(path_midiplayer_4) ""
set midi(midiplayer_1_options) "/play /close"
set midi(midiplayer_2_options) ""
set midi(midiplayer_3_options) ""
set midi(midiplayer_4_options) ""
set midi(path_internet) "c:/Program Files/Internet Explorer/iexplore.exe"} else {
set midi(path_yaps) yaps
set midi(path_abcm2ps) abcm2ps
set midi(path_abcmatch) abcmatch
set midi(path_abc2midi) abc2midi
set midi(path_abc2abc) abc2abc
set midi(path_midi2abc) midi2abc
set midi(path_midicopy) midicopy
set midi(path_midiplayer_1) timidity
set midi(path_midiplayer_2) ""
set midi(path_midiplayer_3) ""
set midi(path_midiplayer_4) ""
set midi(midiplayer_1_options) "-A 50 -ik"
set midi(midiplayer_2_options) ""
set midi(midiplayer_3_options) ""
set midi(midiplayer_4_options) ""
set midi(path_internet) firefox
set midi(path_gs) gs
}
# abc2svg settings
set midi(ps_fmt_file) ""
set midi(fmt_chk) 0
set midi(midi_chk) 0
set midi(remote) 1
set midi(jslib) "./js"
set midi(outhtml) "tune.html"
set midi(webscript) 2
# window geometry
set midi(autoposition) 1
set midi(.) ""
set midi(.msg) ""
set midi(.greetings) ""
set midi(.error_msg) ""
set midi(.abc.copy) ""
set midi(.abcedit) ""
set midi(.gracecfg) ""
set midi(.tmpfile) ""
set midi(.summary) ""
set midi(.notice) ""
set midi(.data_info) ""
set midi(.drumkit) ""
set midi(.dk) ""
set midi(.abcsearch) ""
set midi(.matcher) ""
set midi(.matchcfg) ""
set midi(.midistructure) ""
set midi(.msummary) ""
set midi(.grouper) ""
set midi(.piano) ""
set midi(.ppqn) ""
set midi(.drumroll) ""
set midi(.drumrollconfig) ""
set midi(.pitchpdf) ""
set midi(.durpdf) ""
set midi(.velocitypdf) ""
set midi(.onsetpdf) ""
set midi(.pitchclass) ""
set midi(.midivelocity) ""
set midi(.assoc) ""
set midi(.mftext) ""
set midi(.beatgraph) ""
set midi(.chordstats) ""
set midi(.drumtool) ""
set midi(.cfg_drumtool) ""
set midi(.headers) ""
set midi(.pitchinterval) ""
set midi(.histmatches) ""
set midi(.m2ps) ""
set midi(.live) ""
set midi(.preferred_chords) ""
set midi(.notegram) ""
set midi(.chordgram) ""
set midi(.preferences) ""
set midi(.pgram) ""
# button appearance
set midi(butborder) 3
set midi(butrelief) raised
set midi(butbg) "light grey"
set midi(path_editor) ""
set midi(player) 0
set midi(midiplayer_1_prot) 0
set midi(midiplayer_2_prot) 0
set midi(midiplayer_3_prot) 0
set midi(midiplayer_4_prot) 0
set midi(no_clipboard) 1
set midi(bell_on) 1
set midi(buttonlabels) 0
set midi(noconfirmsave) 0
# abc2midi default parameters
set midi(channel) 1
set midi(program) 0
set midi(chordprog) 0
set midi(bassprog) 0
set midi(beat_a) 105
set midi(beat_b) 95
set midi(beat_c) 80
set midi(beat_n) 4
set midi(beat2_a) 105
set midi(beat2_b) 95
set midi(beat2_c) 80
set midi(double) 0
set midi(octave) 0
set midi(octave2) 0
set midi(program2) 0
set midi(chord_octave) 0
set midi(bass_octave) 0
set midi(melvol) 127
set midi(doublevol) 127
set midi(beat_offset) 10
set midi(ratio_m) 1
set midi(ratio_n) 2
set midi(drummap) 1
set midi(nofermata) 0
set midi(nograce) 0
set midi(quiet) 0
set midi(silent) 0
set midi(chordvol) 127
set midi(bassvol) 127
set midi(transpose) 0
set midi(tuning) 440
set midi(gracedivider) 4
set midi(tempo) 120
set midi(beatsize) 1/4
set midi(drone) 0
set midi(tenordrone) 80
set midi(bassdrone) 80
set midi(drumon) 0
set midi(mydrum) 0
#abc2midi abc2midiu parameters
set midi(easyABCmode) 0
# ab2ps default parameters
set midi(ps_creator) abcm2ps
set midi(ps_scale) 0.8
set midi(ps_width) 500
set midi(ps_lmargin) 20
set midi(ps_glue) fill
set midi(ps_shrink) 0.9
set midi(ps_staffsep) 50
set midi(ps_c) 0
set midi(ps_fmt_flag) 0
set midi(ps_fmt_landscape) 0
set midi(ps_fmt_file) letter.fmt
set midi(ps_maxvent) 4
set midi(ps_maxsent) 800
set midi(bpsvoice) 0
set midi(psvoice) ""
set midi(ps_bbar) 0
set midi(ps_bnumb) 0
set midi(ps_bppage) 0
set midi(ps_bxref) 0
set midi(ps_nolyric) 0
set midi(ps_noslur) 0
set midi(ps_flat) 0
set midi(ps_buffsize) 0
set midi(ps_other_options) ""
set midi(m2ps_output) ps
# yaps default parameters
set midi(papersize) 0
set midi(yaps_voice) 0
set midi(yaps_scale) 0.7
set midi(yaps_lmargin) 50
set midi(yaps_tmargin) 50
set midi(yapsx) 0
set midi(yaps_landscape) 0
set midi(yaps_bbar) 0
# other ps default parameters
set midi(otherps) " > Out.ps"
set midi(barflymode) 0
set midi(stressmodel) 2
# open/save parameters
set midi(abc_open) samples.abc
set midi(midi_save) sample.mid
set midi(history_length) 0
for {set i 0} {$i < 10} {incr i} {set midi(history$i) ""}
set midi(abc_default_file) edit.abc
for {set i 1} {$i <= 20} {incr i} {
set midi(lvoice$i) 64
set midi(voice$i) 0
set midi(pvoice$i) 64
}
set midi(ignoreQ) 0
set midi(ignoremidi) 0
set midi(nogchords) 0
set midi(blank_lines) 1
#
#editor settings
set midi(edit_body_colour) red3
set midi(edit_field_colour) green4
set midi(edit_comment_colour) blue2
set midi(edit_barline_colour) purple
set midi(edit_guitar_colour) deeppink1
set midi(edit_selectbackground) orange
set midi(edit_initial_width) 66
set midi(startnumber) 1
#find setting
set midi(searchdir) "../abcfiles"
set midi(searchForFile) 0
#match settings
set midi(match_timesig) 2/4
set midi(match_keysig) G
set midi(match_length) 1/8
set midi(match_body) GABC|
set midi(match_selection) all
set midi(match_method) sig
set midi(match_mode) 0
set midi(match_norhythm) 0
set midi(grouper_thresh) 1
set midi(levenshtein) 0
# extract settings
set midi(remove_voice) 1
set midi(remove_backslashes) 1
set midi(condense_on) 1
set midi(condense_method) 1
# midi2abc settings
set midi(midifilein) Choose_input_midi_file.mid
set midi(midifileout) test.abc
set midi(abcfileout) frommidi.abc
set midi(midichannels) ""
set midi(miditracks) ""
set midi(beat1) ""
set midi(beat2) ""
set midi(unitval) ""
set midi(anaval) ""
set midi(tsigval) ""
set midi(ksigval) ""
set midi(anamethod) 0
set midi(unitmethod) 2
set midi(chan_method) 1
set midi(trk_method) 1
set midi(beat_method) 1
set midi(tsig_method) 2
set midi(ksig_method) 1
set midi(save_shorts) 0
set midi(no_triplets) 0
set midi(no_grouping) 0
set midi(no_lyrics) 0
set midi(interleave) 0