
proc SelectMetrics {} {
    global WDMetrics InternalWindowing DialogFrame DefPadX DefPadY

    if {$InternalWindowing} {
        set WDMetrics $DialogFrame.metrics
        if {![winfo exists $WDMetrics]} {
            frame $WDMetrics
        }
        
        RegisterDialog "Arc Length Metrics" $WDMetrics SelectMetrics {}
    } else {
        set WDMetrics .metrics
        if {![winfo exists $WDMetrics]} {
            toplevel $WDMetrics
            wm title $WDMetrics "Metrics"
            wm resizable $WDMetrics 0 0
        }
    }

    frame $WDMetrics.options
    pack $WDMetrics.options -padx $DefPadX -pady 5m -side top -anchor w

    label $WDMetrics.options.label -text "Length Labels:" -anchor w
    radiobutton $WDMetrics.options.data -text "Explicit" \
        -variable goblinMethGeometry -value 0 -anchor w
    radiobutton $WDMetrics.options.met1 -text "Manhattan Metrics" \
        -variable goblinMethGeometry -value 1 -anchor w
    radiobutton $WDMetrics.options.met2 -text "Euclidian Metrics" \
        -variable goblinMethGeometry -value 2 -anchor w
    radiobutton $WDMetrics.options.met3 -text "Maximum Metrics" \
        -variable goblinMethGeometry -value 3 -anchor w
    radiobutton $WDMetrics.options.met4 -text "Spheric Distances" \
        -variable goblinMethGeometry -value 4 -anchor w
    pack $WDMetrics.options.label $WDMetrics.options.data \
        $WDMetrics.options.met1 $WDMetrics.options.met2 \
        $WDMetrics.options.met3 $WDMetrics.options.met4 -side top -fill x
     
    frame $WDMetrics.buttons
    pack $WDMetrics.buttons -padx 3m -pady 3m -side bottom

    button $WDMetrics.buttons.done -text "Done" -command { \
        PropagateModifications
        if {$InternalWindowing} {
            DestroyActiveDialog
        } else {
            destroy $WDMetrics
        }
    }    

    pack $WDMetrics.buttons.done -side left -fill x -padx 3m

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

global WDMetrics
if {![info exists WDMetrics] || ![winfo exists $WDMetrics]} {SelectMetrics}
