### Copyright (C) 1998 MOTOYAMA, Mashio<moto@ba.mbn.or.jp>
### 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

proc symbolDefinition {} {
    # シンボルの定義
    Desc シンボルの定義
    ShortDesc シンボルの定義
    Line splitter
    Entry wKey\
	    -textafter "キーを打鍵したら"\
	    -width 5\
	    -help "打ち込まれるキーを入力します(e.g. a, 0, \\, ...)"
    Entry wSym\
	    -width 5\
	    -textafter "を入力する"\
	    -help "読み入力モードに表示させたい文字を入力します(e.g. あ)"
    ExtEntry adSymbols\
	    -entries {wSym}\
	    -count 3\
	    -help "読み入力モードに表示させたい文字を入力します(複数指定可)"
    ExtEntry defSymbols\
	    -entries {splitter wKey adSymbols}\
	    -count 3\
	    -help "ローマ字かな変換の補助テーブルを設定します。\
	    読み入力モードで特定のキーを打鍵したとき、\
	    何の文字が表示されるかを設定します。文字は複数指定可能です"
    Save {
	set i 0
	forevery defSymbols {
	    if {$wKey != ""} {
		set allSymbols ""
		foreach special {\\ \" \'} {
		    if {$wKey == $special} {
			set wKey "\\$wKey"
		    }
		}
		forevery adSymbols {
		    if {$wSym != ""} {
			foreach special {\\ \" \'} {
			    if {$wSym == $special} {
				set wSym "\\$wSym"
			    }
			}
			set allSymbols "$allSymbols \"$wSym\""
		    }
		}
		set i [expr $i + 1]
		set addition($i) "\?$wKey $allSymbols"
	    }
	}
	if {$i != 0} {
	    print "(defsymbol"
	    foreach j [lsort -integer [array names addition]] {
		if {$addition($j) !=""} {
		    print "    $addition($j)"
		}
	    }
	    print ")"
	    unset addition
	}
    }
}

