
#-------------------------------------------------------------------------------
# Module:     browserLogOpt.tk
# Activation: Dynamically loadad on user request
# Scope:      Selection of logging information
#-------------------------------------------------------------------------------



proc SelectLoggingOptions {} {
    global WDLogOpt InternalWindowing DialogFrame DefPadX DefPadY

    if {$InternalWindowing} {
        set WDLogOpt $DialogFrame.logopt
        if {![winfo exists $WDLogOpt]} {
            frame $WDLogOpt
        }
        
        RegisterDialog "Logging Options" $WDLogOpt SelectLoggingOptions {}
    } else {
        set WDLogOpt .logopt
        if {![winfo exists $WDLogOpt]} {
            toplevel $WDLogOpt
            wm title $WDLogOpt "Logging Options"
            wm resizable $WDLogOpt 0 0
        }
    }

    frame $WDLogOpt.buttons
    button $WDLogOpt.buttons.done -text "Done" -command { \
        if {$InternalWindowing} {
            DestroyActiveDialog
        } else {
            destroy $WDLogOpt
        }
    }
    
    pack $WDLogOpt.buttons.done \
        -side left -fill x -padx 3m
     
    pack $WDLogOpt.buttons -padx 3m -pady 3m -side bottom

    frame $WDLogOpt.f1
    frame $WDLogOpt.f1.methods
    frame $WDLogOpt.f1.results
    frame $WDLogOpt.f1.memory
    frame $WDLogOpt.f1.check
    pack $WDLogOpt.f1.methods $WDLogOpt.f1.results $WDLogOpt.f1.memory \
        $WDLogOpt.f1.check -side top -fill x -pady 3m
     
    pack $WDLogOpt.f1 -side top -fill x -padx $DefPadX -pady 3m


    label $WDLogOpt.f1.methods.label -text "Algorithms:" -anchor w
    radiobutton $WDLogOpt.f1.methods.noInfo -text "No Information" \
        -variable goblinLogMethods -value 0 -anchor w
    radiobutton $WDLogOpt.f1.methods.top -text "Big Iterations" \
        -variable goblinLogMethods -value 1 -anchor w
    radiobutton $WDLogOpt.f1.methods.details -text "Detailed Information" \
        -variable goblinLogMethods -value 2 -anchor w
    pack $WDLogOpt.f1.methods.label \
        $WDLogOpt.f1.methods.noInfo \
        $WDLogOpt.f1.methods.top \
        $WDLogOpt.f1.methods.details \
        -fill x
        
    label $WDLogOpt.f1.results.label -text "Computational Results:" -anchor w
    radiobutton $WDLogOpt.f1.results.noInfo -text "No Information" \
        -variable goblinLogResults -value 0 -anchor w
    radiobutton $WDLogOpt.f1.results.top -text "Big Iterations" \
        -variable goblinLogResults -value 1 -anchor w
    radiobutton $WDLogOpt.f1.results.details -text "Detailed Information" \
        -variable goblinLogResults -value 2 -anchor w
    pack $WDLogOpt.f1.results.label \
        $WDLogOpt.f1.results.noInfo \
        $WDLogOpt.f1.results.top \
        $WDLogOpt.f1.results.details \
        -fill x
        
    label $WDLogOpt.f1.memory.label -text "Memory Management:" -anchor w
    radiobutton $WDLogOpt.f1.memory.noInfo -text "No Information" \
        -variable goblinLogMemory -value 0 -anchor w
    radiobutton $WDLogOpt.f1.memory.allocs -text "Allocation Operations" \
        -variable goblinLogMemory -value 1 -anchor w
    radiobutton $WDLogOpt.f1.memory.size -text "Size Information" \
        -variable goblinLogMemory -value 2 -anchor w
    pack $WDLogOpt.f1.memory.label \
        $WDLogOpt.f1.memory.noInfo \
        $WDLogOpt.f1.memory.allocs \
        $WDLogOpt.f1.memory.size \
        -fill x
        
    checkbutton $WDLogOpt.f1.check.manipulate -text "Graph Manipulations" \
        -variable goblinLogManipulate -anchor w
    checkbutton $WDLogOpt.f1.check.io -text "I/O operations" \
        -variable goblinLogIO -anchor w
    checkbutton $WDLogOpt.f1.check.timers -text "Timer reports" \
        -variable goblinLogTimers -anchor w
    checkbutton $WDLogOpt.f1.check.gaps -text "Duality Gaps" \
        -variable goblinLogGaps -anchor w
    checkbutton $WDLogOpt.f1.check.warnings -text "Warnings and Rejections" \
        -variable goblinLogWarnings -anchor w
    pack $WDLogOpt.f1.check.manipulate \
        $WDLogOpt.f1.check.io \
        $WDLogOpt.f1.check.timers \
        $WDLogOpt.f1.check.gaps \
        $WDLogOpt.f1.check.warnings \
        -fill x

    if {$InternalWindowing} {
        pack $WDLogOpt -anchor nw
        AlignActiveDialog
    }
}

global WDLogOpt
if {![info exists WDLogOpt] || ![winfo exists $WDLogOpt]} {SelectLoggingOptions}
