+proc insertWithTags {w text args} {
+ set start [$w index insert]
+ $w insert insert $text
+ foreach tag [$w tag names $start] {
+ $w tag remove $tag $start insert
+ }
+ foreach i $args {
+ $w tag add $i $start insert
+ }
+}
+
+proc show-full-marc {no} {
+ global setNo
+
+ set w .full-marc
+
+ if {[winfo exists $w]} {
+ $w.top.record delete 0.0 end
+ set new 0
+ } else {
+
+ toplevel $w
+
+ wm minsize $w 200 200
+
+ frame $w.top -relief raised -border 1
+ frame $w.bot -relief raised -border 1
+
+ # pack $w.top $w.bot -side top -fill both -expand yes
+ pack $w.top -side top -fill both -expand yes
+ pack $w.bot -fill both
+
+ text $w.top.record -width 60 -height 10 \
+ -yscrollcommand "$w.top.s set"
+ scrollbar $w.top.s -command "$w.top.record yview"
+
+ set new 1
+ }
+ incr no
+
+ set r [z39.$setNo recordMarc $no line * * *]
+
+ $w.top.record tag configure marc-tag -foreground blue
+ $w.top.record tag configure marc-data -foreground black
+ $w.top.record tag configure marc-id -foreground red
+
+ foreach line $r {
+ set tag [lindex $line 0]
+ set indicator [lindex $line 1]
+ set fields [lindex $line 2]
+
+ if {$indicator != ""} {
+ insertWithTags $w.top.record "$tag $indicator" marc-tag
+ } else {
+ insertWithTags $w.top.record "$tag " marc-tag
+ }
+ foreach field $fields {
+ set id [lindex $field 0]
+ set data [lindex $field 1]
+ if {$id != ""} {
+ insertWithTags $w.top.record " $id " marc-id
+ }
+ set start [$w.top.record index insert]
+ insertWithTags $w.top.record $data {}
+ }
+ $w.top.record insert end "\n"
+ }
+ if {$new} {
+ bind $w <Return> {destroy .full-marc}
+
+ pack $w.top.s -side right -fill y
+ pack $w.top.record -expand yes -fill both
+
+ frame $w.bot.left -relief sunken -border 1
+ pack $w.bot.left -side left -expand yes -padx 5 -pady 5
+ button $w.bot.left.close -width 6 -text {Close} \
+ -command {destroy .full-marc}
+ pack $w.bot.left.close -expand yes -padx 3 -pady 3
+ button $w.bot.edit -width 6 -text {Edit} \
+ -command {destroy .full-marc}
+ pack $w.bot.edit -side left -expand yes
+ }
+}
+