# Voreinstellungsmenü für Syntaxprüfung
#
# Copyright (C) 1999  G. Lamprecht, W. Lotz, R. Weibezahn; IWD, Bremen University

proc sv  {} {

proc svanzeig {s1} {
 global vv Ws sytext syntax syoptions
 if [winfo exists $Ws.b.ad] {
   if {$syntax==""} {$Ws.b.ad configure -text "$vv(svbad1)"} \
   elseif {$syntax==$sytext} {$Ws.b.ad configure -text "$vv(svbad2)  $syntax"} \
   else {$Ws.b.ad configure -text "$vv(svbad2)  $syntax  ($sytext)"}
 }
 $Ws.cb delete 0 end; $Ws.cb insert end "$syoptions"
 if {$s1!=""} {writescr0 $Ws.d.tt \
	"$s1\n\n$sytext\n\n $vv(ausg2)  $syntax\n $vv(ausg3)  $syoptions\n"}
}

proc svsel {s} {
 global Ws vv svsep syntax sytext syoptions svsel_v
 svfocus $Ws.d.tt
 set sytext    [getvalue $s 0 $svsep]; set syntax [getvalue $s 1 $svsep]
 set syoptions [getvalue $s 2 $svsep]
 svanzeig "$vv(sv1)"; knoepfe; set svsel_v "$s"
}

proc svfocus {w} {global Ws svFoc; if {$svFoc==1} {svopt}; if {$w!=""} {focus $w} {focus $Ws}}

proc svopt {} {
 global Ws vv syoptions svFoc
 set syoptions [$Ws.cb get]; writescr0 $Ws.d.tt "$vv(aus4)\n $syoptions\n"
 set svFoc 0
}

proc svWsae {} {global Ws; svfocus ""; destros $Ws; knoepfe; unlock_list}


global vv Ws sytext svsep geom svsel_v svFoc

toplevel_init $Ws "$vv(svvor)" 0 0;  set tyh 18


# Bereich a fuer erste Buttons

insertTopButtons $Ws sv_h svWsae
button $Ws.a.g -text "$vv(ag)" -command \
	{svfocus $Ws.d.tt; vstr_syntax;svanzeig "$vv(ausg1)"; knoepfe}
Bind3HF $Ws.a.g sv_grund $Ws.d.tt
pack configure $Ws.a.g -side left -padx 3 -pady 3


# Bereich bv fuer eigene Einstellungen

frame  $Ws.bv; pack configure $Ws.bv -pady 13 -anchor w
label  $Ws.bv.dv -text "$vv(bvdv)" -width 23 -anchor w
Bind3HF $Ws.bv.dv z_voreinst1 $Ws.d.tt
button $Ws.bv.va -text "$vv(bvva)" -command {svfocus ""; svanzeig "$vv(aus0)"}
Bind3HF $Ws.bv.va z_voreinst1 $Ws.d.tt
pack configure $Ws.bv.dv $Ws.bv.va -side left


# Bereich b fuer Anzeigen

frame $Ws.b; pack configure $Ws.b -anchor w
label $Ws.b.ad -width 90 -anchor w; pack configure $Ws.b.ad -anchor w
Bind3HF $Ws.b.ad sv_anzeig $Ws.d.tt


# Bereich c Wechsel

frame $Ws.c; pack configure $Ws.c -anchor w
set svsep [getsep syntax.vst]
CreateLSBox $Ws.c $vv(svcl) left 55 8 2 sv_progsel $Ws.d.tt \
	$svsep [vst2list syntax.vst 1 $svsep "$sytext" svsel_v] svsel "" svWsae
if ![winfo exists $Ws.c.f.f.li] {destroy $Ws.b}


# Ausgabe und Veraendern des Optionen-Strings

label $Ws.ca -anchor sw -text "$vv(svca)"; pack configure $Ws.ca -anchor sw -ipady 5
Bind3HF $Ws.ca sv_optedi $Ws.d.tt
entry $Ws.cb -width 80 -relief sunken; pack configure $Ws.cb -anchor nw -padx 4
bind  $Ws.cb <Button-1> {svfocus $Ws.cb; set svFoc 1}
Bind3HF $Ws.cb sv_optedi $Ws.d.tt
bind  $Ws.cb <Return> {svopt; svfocus $Ws.d.tt}


InsertTextFrame $Ws $tyh "" "" ""

svanzeig ""; set svFoc 0
}
