#************************************************************
# saveseldlg.tcl
#
# Save Selection Dialog box
#
# Author : Dan Gunter
# Created: 7/17/98
#
#************************************************************

#########################
# SaveSelect --
#
#    Widget to save a selection
#
proc SaveSelect { parent } {
    global param prOpt env

    set bwid 10
    set bbg $param(color-buttonbg)
    set bag $param(color-buttonabg)
    set bfg $param(color-buttonfg)
    set cbg $param(color-ctlbg)
    set lbg #ffffff

    toplevel $parent

    # Frames

    frame $parent.main -bg $cbg
       frame $parent.main.other -bg $cbg
          frame $parent.main.other.range -bg $cbg
       frame $parent.main.events -bg $cbg
    frame $parent.button -bg $cbg

    # Stuff inside of frames

    # "Other" frame
    set f $parent.main.other
    label $f.rtitle -text "Time Range" -bg $lbg -highlightbackground $lbg
    entry $f.range.r1 -bg white
    entry $f.range.r2 -bg white
    label $f.ftitle -text "File" -bg $lbg -highlightbackground $lbg
    entry $f.f -bg white
    pack $f.range.r1 $f.range.r2 -side left -side top -fill both -expand 1
    pack $f.rtitle -anchor w -side top -fill both -expand 1
    pack $f.range -side top -fill both -expand 1
    pack $f.ftitle -anchor w -side top -fill both -expand 1
    pack $f.f -side top -fill both -expand 1

    # Events frame
    set f $parent.main.events
    label $f.etitle -text "Events" -bg $lbg -highlightbackground $lbg
    pack $f.etitle -side top -fill x -anchor n
    
    # "Main" frame = Other + Events
    pack $parent.main.other $parent.main.events -side left -anchor n  \
	-fill both -expand 1

    # Buttons frame
    set f $parent.button
    button $f.merge -text "Merge"
    button $f.replace -text "Replace"
    button $f.cancel -text "Cancel"
    pack $f.merge $f.replace $f.cancel -side left -fill both
    
    # Whole thing
    pack $parent.main $parent.button -side top -expand 1 -fill both
    
    return $parent
}

#########################
# ShowSaveselDlg --
#
#    Initialize and draw the widget
#
proc ShowSaveselDlg { } {
    global param didPause

    if { $param(Paused) == 0 } { 
	set param(Paused) 1
	Pause
	set didPause 1 
    } else {
	set didPause 0
    }
    set dlg [SaveSelect .savesel]
    wm title $dlg "Save Selection"
    wm geometry $dlg +100+200
}
global didPause
