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

proc rv  {} {

proc rvanzeige {s1} {
  global vv Wr sptext spcmd splang spoptions
  if [winfo exists $Wr.b.ad] {
    if {$spcmd==""} {$Wr.b.ad configure -text "$vv(rvbad1)"} \
    elseif {$spcmd==$sptext} {$Wr.b.ad configure -text "$vv(rvbad2) $spcmd"} \
    else {$Wr.b.ad configure -text "$vv(rvbad2) $spcmd  ($sptext)"}
  }
  $Wr.cb delete 0 end; $Wr.cb insert end "$spoptions"
  if {$s1!=""} {writescr0 $Wr.d.tt \
	"$s1\n\n$sptext\n\n $vv(rv2)  $spcmd\n $vv(rv3)  $splang\n $vv(rv4)  $spoptions\n"}
}

proc rvsel {s} {
  global Wr vv rvsep sptext spcmd splang spcorr spselect spoptions sptext rvsel_v
  rvfocus $Wr.d.tt
  set sptext   [getvalue $s 0 $rvsep]; set spcmd     [getvalue $s 1 $rvsep]
  set splang   [getvalue $s 2 $rvsep]; set spcorr    [getvalue $s 3 $rvsep]
  set spselect [getvalue $s 4 $rvsep]; set spoptions [getvalue $s 5 $rvsep]
  rvanzeige "$vv(rv5)"; knoepfe; set rvsel_v "$s"
}

proc rvfocus {w} {global Wr rvFoc; if {$rvFoc==1} {rvopt}; if {$w!=""} {focus $w} {Focus $Wr}}

proc rvopt {} {
  global Wr vv spoptions rvFoc
  set spoptions [$Wr.cb get]; writescr0 $Wr.d.tt "$vv(aus4)\n $spoptions\n"
  set rvFoc 0
}

proc rvWrae {} {global Wr; rvfocus ""; destros $Wr; knoepfe; unlock_list}


global vv Wr sptext rvsep rvsel_v rvFoc

toplevel_init $Wr "$vv(rvvor)" 0 0;  set tyh 12


# Bereich a fuer erste Buttons

insertTopButtons $Wr rv_h rvWrae
button $Wr.a.g -text "$vv(ag)" -command \
	{rvfocus $Wr.d.tt; vstr_spell; rvanzeige "$vv(ausg1)"; knoepfe}
Bind3HF $Wr.a.g rv_grund $Wr.d.tt
pack configure $Wr.a.g -side left -padx 3 -pady 3


# Bereich bv fuer eigene Einstellungen

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


# Bereich b fuer Anzeigen

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


# Bereich c fuer Wechsel

frame $Wr.c; pack configure $Wr.c -anchor w
set rvsep [getsep spellcheck.vst]
CreateLSBox $Wr.c $vv(rvcdl) top 80 9 2 rv_progsel $Wr.d.tt \
	$rvsep [vst2list spellcheck.vst 1 $rvsep "$sptext" rvsel_v] rvsel "" rvWrae
if ![winfo exists $Wr.c.f.f.li] {destroy $Wr.b}


# Ausgabe und Veraendern des Optionen-Strings

label $Wr.ca -anchor sw -text "$vv(rvca)"; pack configure $Wr.ca -anchor sw -ipady 5
Bind3HF $Wr.ca rv_optedi $Wr.d.tt
entry $Wr.cb -width 80 -relief sunken; pack configure $Wr.cb -anchor nw -padx 4
bind  $Wr.cb <Button-1> {rvfocus $Wr.cb; set rvFoc 1}
Bind3HF $Wr.cb rv_optedi $Wr.d.tt
bind  $Wr.cb <Return> {rvopt; rvfocus $Wr.d.tt}


InsertTextFrame $Wr $tyh "" "" ""

rvanzeige ""; set rvFoc 0
}
