# .tkabcrc - tkabc custom keystrokes (Hudson Lacerda) -*- tcl -*-

# For tclabc-1.0.7     http://moinejf.free.fr

# ESTE ARQUIVO DEVE SER SALVO COMO ~/.tkabcrc
# THIS FILE MUST BE SAVED AS ~/.tkabcrc

#############
# PORTUGUÊS #
#############
#
# Este arquivo de configuração de tkabc.tcl (http://moinejf.free.fr)
# implementa teclas de atalho que acho mais práticas que as originais.
#
# Uma diferença sensível é que a tecla `a' insere uma nota, ao
# contrário do que continua a ser indicado no menu `Ficheiro | Opções
# de visualização'.  O atalho `Shift-A' (`A' maiúsculo) é usado para
# esta função.
#
# Além disso, uma janela de confirmação é aberta quando a tecla `q'
# (Sair) é apertada.
#
# As teclas de setas acima/abaixo e page-up/page-down mudam a altura
# da nota, o tipo de barra de compasso, o número superior da fórmula
# de compasso, a armadura de tonalidade (com transposição) ou a clave.
#
# Control- muda a oitava da nota.
#
# Shift- muda a duração da nota ou o número inferior da
# fórmula de compasso, ou a linha da clave.
#
# Alt- anda um compasso.
#
# Alt- muda para outra voz.
#
# Shift-V (`V' maiúsculo) adiciona uma nova voz.
#
# Shift-E (`E' maiúsculo) salva e edita o arquivo com emacs.
#
# Control-n adiciona uma música (vazia) ao arquivo.
#
# Acidentes são inseridos com:
#	1 bemol
#	2 natural (alterna bequadro/nenhum acidente)
#	3 sustenido
#	! dobrado bemol
#	@ bequadro
#	# dobrado sustenido
#	Alt-1 bemol de 1/4 de tom
#	Alt-3 sustenido de 1/4 de tom
#	Alt-! bemol de 3/4 de tom
#	Alt-# sustenido de 3/4 de tom
#
# `u' atualiza a previsualização (como `Shift-P', roda abc2ps, mas não
# chama ghostview).

###########
# ENGLISH #
###########
# 
# This config file for tkabc.tcl (http://moinejf.free.fr) implements
# keystrokes that I find more convenient than the original ones.
#
# An important difference is that `a' inserts a note, rather than
# configure abcm2ps options as it continues to be shown in the menu
# `File'. `Shift-A' (capital `A') is used for that.
#
# Moreover, a confirmation dialog is open when `q' (quit) is pressed.
#
# The arrow keys up/down as well as PageUp/PageDown change things like
# the pitch of the note, the type of bar line, the numerator of time
# signature, the key signature (with transposition) or the clef.
#
# Control- change the octave of the note.
#
# Shift- change the note length, the denominator of time
# signature or the clef line.
#
# Alt- move by one measure.
#
# Alt- move to another voice.
#
# Shift-V (capital `V') create a new voice.
#
# Shift-E (capital `E') save and edit the file with Emacs.
#
# Control-n create a new music in the same file.
#
# Accidentals:
#	1 flat
#	2 natural (toggle natural/no accidental)
#	3 sharp
#	! double flat
#	@ natural sign
#	# double sharp
#	Alt-1 1/4-tone flat (semiflat)
#	Alt-3 1/4-tone sharp (semisharp)
#	Alt-! 3/4-tone flat (sesquiflat)
#	Alt-# 3/4-tone sharp (sesquisharp)
#
# `u' update preview (whithout calling ghostview)

proc update-preview {} {
# preview the current tune
    global opt tune
    set abcfile $opt(tmpdir)/tmp.abc
    set fd [open $abcfile {w}]
    puts $fd [abc dump]
    close $fd
    set npsfile [file nativename $opt(tmpdir)/tmp.ps]
    set prg "exec {$opt(abc2ps)} $opt(abc2ps-args) $tune(preview-args) {[file nativename $abcfile]} -O {$npsfile}"
    catch {eval $prg} rc
    tk_messageBox -type ok -message "abc(m)2ps result\n$rc" \
	-title {abc(m)2ps result}
#    exec $opt(ghostview) $npsfile &
#    exec rm $abcfile $psfile
}

proc post-init {} {

# Update preview (run abc2ps without calling ghostview)
	bind .f.c  update-preview

# Edit file with emacs
	bind .f.c  {global tune
	    tune-save
	    catch "exec emacsclient -a emacs $tune(fname)"
	    tune-reload}
# N.B. emacclient requires the following line in ~/.emacs :
#      (server-start)

# Create a new tune in the same file
	bind .f.c  {tune-new}

# When 'q' (quit), ask for confirmation
	bind .f.c  {
	    global lang tune
	    switch [tk_messageBox -type okcancel  -title $lang(m_quit)? \
			-message $lang(m_quit)?] {
			    ok {   
				quit
			    }   
			    cancel {
			    }   
			}   
	}

# fixme: Alt-a is also included as Key-a
	bind .f.c  [list sym-add n]		;# insert note (good)
	bind .f.c  prevargs			;# preview args
	# bind .f.c  {help; show-keys}
	# bind .f.c  [list sym-add k]
	bind .f.c  {voice-new}		;# insert new voice

# change pitch (OK)
	bind .f.c  [list sym-pitch -1]		;# change note up/dn
	bind .f.c  [list sym-pitch 1]
	bind .f.c  [list sym-pitch -1]
	bind .f.c  [list sym-pitch 1]

# move to bar (revise along 'move to voice')
	bind .f.c  [list cursor-move -1b]	;# previous bar
	bind .f.c  [list cursor-move 1b]	;# next bar

# move to voice (revise)
	bind .f.c  [list updn 0]		;# prev voice
	bind .f.c  [list updn 1] 		;# next voice
	bind .f.c  [list updn 1]
	bind .f.c  [list updn 0]
	bind .f.c  [list updn 1]
	bind .f.c  [list updn 0]
	bind .f.c  [list updn 1]
	bind .f.c  [list updn 0]

# change octave (revise)
	bind .f.c  [list sym-pitch 7]	;# oct+
	bind .f.c  [list sym-pitch 7]	;# oct+
	bind .f.c  [list sym-pitch 7]	;# oct+
	bind .f.c  [list sym-pitch -7]	;# oct-
	bind .f.c  [list sym-pitch -7]	;# oct-
	bind .f.c  [list sym-pitch -7]	;# oct-

# accidentals (OK)
	bind .f.c  [list sym-acc 1]	;# sharp
	bind .f.c  [list sym-acc 0]	;# natural/none (toggle)
	bind .f.c  [list sym-acc 3]	;# flat
	bind .f.c  [list sym-acc 5]	;# double flat
	bind .f.c  [list sym-acc 2]		;# bequadro (natural sign)
	bind .f.c  [list sym-acc 4]	;# double sharp
# microtonal accidentals (tkabc-1.0.6)
	bind .f.c  [list sym-acc 9]		;# semisharp
	bind .f.c  [list sym-acc 4105]	;# sesquisharp
	bind .f.c  [list sym-acc 11]     	;# semiflat
	bind .f.c  [list sym-acc 4107]	;# sesquiflat

# change duration -- REVISE THIS
	bind .f.c  [list sym-len plus]	;# good shortcut
	bind .f.c  [list sym-len minus]	;# good shortcut
	bind .f.c  [list sym-len plus]
	bind .f.c  [list sym-len plus]
	bind .f.c  [list sym-len minus]
	bind .f.c  [list sym-len minus]
# new versions
	bind .f.c  [list sym-len plus]
	bind .f.c  [list sym-len plus]
	bind .f.c  [list sym-len plus]
	bind .f.c  [list sym-len minus]
	bind .f.c  [list sym-len minus]
	bind .f.c  [list sym-len minus]

} ;#####



# below settings managed by tkabc



# USER SETTINGS
# everything between here and the END OF USER SETTINGS comment line
# will be rewritten on a Preference Save
array set opt {
	abc2ps abcm2ps
	abc2ps-args {}
	bg LightYellow
	chg_bg LightPink1
	detail 1
	ent_bg AntiqueWhite
	follow 1
	ghostview gv
	lang lang-ptBR.tcl
	midiin /dev/midi00
	midiin-start 0
	midiout /dev/sequencer
	midiout-start 1
	nochg_bg DarkSeaGreen2
	playnote 0
	screen-h 563
	screen-w 731
	tempo 76
	tmpdir /tmp
	twosel 0
	v_color white
	vel 104
}
# END OF USER SETTINGS

    Source: geocities.com/br/hfmlacerda/abc

               ( geocities.com/br/hfmlacerda)                   ( geocities.com/br)