
#-------------------------------------------------------------------------------
# Module:     browserOptions.tk
# Activation: Dynamically loadad on user request
# Scope:      Browser options dialog
#-------------------------------------------------------------------------------



proc SelectBrowserOptions {} {
    global WDBrowseOpt DialogFrame DefPadX DefPadY ActiveDialog ChangeOptions \
        AlignOptions InternalWindowing BalloonHelp BruteOverwrite BackupLevel \
        Fr2Options Fr1Options

    set title "Browser Options"

    if {[RegisterFormOrWindow $title browseopt WDBrowseOpt SelectBrowserOptions \
            "Done"          {} \
            ""              {} \
            ""              {} \
            ""              {} \
        ]
    } {
        return
    }

    
    frame $WDBrowseOpt.f1
    frame $WDBrowseOpt.f1.saveopt
#    frame $WDBrowseOpt.f1.align
    frame $WDBrowseOpt.f1.check
    frame $WDBrowseOpt.f1.backup
    pack $WDBrowseOpt.f1.saveopt $WDBrowseOpt.f1.check $WDBrowseOpt.f1.backup \
        -side top -fill x -pady 3m
     
    pack $WDBrowseOpt.f1 -side top -fill x -padx $DefPadX -pady 3m

    label $WDBrowseOpt.f1.saveopt.label -text "Dismissed Objects:" -anchor w
    radiobutton $WDBrowseOpt.f1.saveopt.save -text "Automatically Save To File" \
        -variable ChangeOptions -value 0 -anchor w
    radiobutton $WDBrowseOpt.f1.saveopt.ask -text "Require Confirmations" \
        -variable ChangeOptions -value 1 -anchor w
    radiobutton $WDBrowseOpt.f1.saveopt.exit -text "Do Not Save To File" \
        -variable ChangeOptions -value 2 -anchor w
    pack $WDBrowseOpt.f1.saveopt.label $WDBrowseOpt.f1.saveopt.save \
        $WDBrowseOpt.f1.saveopt.ask $WDBrowseOpt.f1.saveopt.exit -side top -fill x
     
#    label $WDBrowseOpt.f1.align.label -text "Fit Graph Into Canvas:" -anchor w
#    radiobutton $WDBrowseOpt.f1.align.user -text "Only By User Demand" \
#        -variable AlignOptions -value 0 -anchor w
#    radiobutton $WDBrowseOpt.f1.align.trace -text "When Tracing Algorithms" \
#        -variable AlignOptions -value 1 -anchor w
#    radiobutton $WDBrowseOpt.f1.align.always -text "Every Time Object Is Drawn" \
#        -variable AlignOptions -value 2 -anchor w
#    pack $WDBrowseOpt.f1.align.label $WDBrowseOpt.f1.align.user \
#        $WDBrowseOpt.f1.align.trace $WDBrowseOpt.f1.align.always -side top -fill x
    
    checkbutton $WDBrowseOpt.f1.check.popup -text "Pop-Up Infos" \
        -variable BalloonHelp -anchor w
    checkbutton $WDBrowseOpt.f1.check.attach -text "Attach Slave Windows" \
        -variable InternalWindowing -anchor w -command {
            AdjustDialogPadding

            foreach title $RegisteredDialogs {
                if {$InternalWindowing} {
                    destroy $RegisteredPath($title)
                } else {
                    DestroyForm $title
                }
            }

            SelectBrowserOptions
        }
    checkbutton $WDBrowseOpt.f1.check.overwrite \
        -text "Overwrite Without Warning" -variable BruteOverwrite -anchor w
    pack $WDBrowseOpt.f1.check.popup $WDBrowseOpt.f1.check.attach \
        $WDBrowseOpt.f1.check.overwrite -side top -fill x

    label $WDBrowseOpt.f1.backup.label -text "Undo Stack Size:  " -anchor w
    entry $WDBrowseOpt.f1.backup.entry -textvariable BackupLevel \
        -bg white -width 3
    pack $WDBrowseOpt.f1.backup.label $WDBrowseOpt.f1.backup.entry -side left -fill x


    DisplayForm $title
}

SelectBrowserOptions
