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

proc bv  {} {

proc bvanzeige {s1} {
  global vv Wb bitext bibtex bioptions texpostbib bvFoc
  TestPut 4 "<$s1>"
  if [winfo exists $Wb.b.ad] {
    if {$bibtex==""} {$Wb.b.ad configure -text "$vv(svbad1)"} \
    elseif {$bibtex==$bitext} {$Wb.b.ad configure -text "$vv(svbad2)  $bibtex"} \
    else {$Wb.b.ad configure -text "$vv(svbad2)  $bibtex  ($bitext)"}
  }
  if {($s1=="disp")&&($bvFoc!=0)} {bvopt}
  $Wb.cb delete 0 end;  $Wb.cb insert end "$bioptions"
  if {$s1!=""} {
    writescr0 $Wb.d.tt	"$s1\n\n$bitext\n\n $vv(ausg2)  $bibtex\n $vv(ausg3) $bioptions\n" \
			" texpostbib: $texpostbib\n"
  }
}

proc bvsel {s} {
  global Wb vv bvsep bitext bibtex bioptions bvsel_v
  bvfocus $Wb.d.tt
  set bitext    [getvalue $s 0 $bvsep]; set bibtex [getvalue $s 1 $bvsep]
  set bioptions [getvalue $s 2 $bvsep]
  bvanzeige "$vv(bv2)"; knoepfe; set bvsel_v "$s"
}

proc bvfocus {w} {global Wb bvFoc; if {$bvFoc==1} {bvopt}; if {$w!=""} {focus $w} {Focus $Wb}}

proc bvopt {} {
  global Wb vv bioptions bvFoc
  set bioptions [$Wb.cb get]; writescr0 $Wb.d.tt "$vv(aus4)\n $bioptions\n"
  set bvFoc 0
}

proc bvWbae {} {global Wb; bvfocus ""; destros $Wb; knoepfe; unlock_list}


global vv Wb bitext bvsep geom bvsel_v bvFoc

toplevel_init $Wb "$vv(bvvor)" 0 0;  set tyh 18


# Bereich a fuer erste Buttons

insertTopButtons $Wb bv_h bvWbae
button $Wb.a.g -text "$vv(ag)" -command \
	{bvfocus $Wb.d.tt; vstr_bibtex; bvanzeige "$vv(ausg1)"; knoepfe}
Bind3HF $Wb.a.g bv_grund $Wb.d.tt
pack configure $Wb.a.g -side left -padx 3 -pady 3


# Bereich bv fuer eigene Einstellungen

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


# Bereich b fuer Anzeigen   

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


# Bereich c fuer Wechsel

frame $Wb.c; pack configure $Wb.c -anchor w
frame $Wb.c.bpp; pack configure $Wb.c.bpp -pady 1 -anchor e;#bibtex program
frame $Wb.c.bra; pack configure $Wb.c.bra -pady 1 -anchor e;#bibtex after Tex automatically

set bvsep [getsep bibtex.vst]
CreateLSBox $Wb.c.bpp $vv(bvcl) left 45 8 2 bv_progsel $Wb.d.tt \
	$bvsep [vst2list bibtex.vst 1 $bvsep "$bitext" bvsel_v] bvsel "" bvWbae
if ![winfo exists $Wb.c.f.f.li] {destroy $Wb.b}
CreateRBBox $Wb.c.bra $vv(bvcr) "" left 45 2 bv_texpost $Wb.d.tt texpostbib \
	{bvanzeige disp; bvfocus $Wb.d.tt} bvWbae ""

# Ausgabe und Veraendern des Optionen-Strings

label $Wb.ca -anchor sw -text "$vv(bvca)"; pack configure $Wb.ca -anchor sw -ipady 5
Bind3HF $Wb.ca bv_optedi $Wb.d.tt
entry $Wb.cb -width 80 -relief sunken;  pack configure $Wb.cb -anchor nw -padx 4
bind  $Wb.cb <Button-1> {bvfocus $Wb.cb; set bvFoc 1}
Bind3HF $Wb.cb bv_optedi $Wb.d.tt
bind  $Wb.cb <Return> {bvopt; bvfocus $Wb.d.tt}


InsertTextFrame $Wb $tyh "" "" ""

bvanzeige ""; set bvFoc 0
}
