
destroy .randopt
toplevel .randopt
wm title .randopt "GOBLIN Instance Generator"
wm resizable .randopt 0 0
     
frame .randopt.f1
    label .randopt.f1.label -text "Random Labels:" -anchor w
    checkbutton .randopt.f1.length -text "Length Labels" \
        -variable goblinRandLength -anchor w
    checkbutton .randopt.f1.ucap -text "Upper Bounds" \
        -variable goblinRandUCap -anchor w
    checkbutton .randopt.f1.lcap -text "Lower Bounds" \
        -variable goblinRandLCap -anchor w
    checkbutton .randopt.f1.geometry -text "Geometric Embedding" \
        -variable goblinRandGeometry -anchor w
    pack .randopt.f1.label .randopt.f1.length .randopt.f1.ucap \
        .randopt.f1.lcap .randopt.f1.geometry -side top -fill x
     
set goblinRandEuler 0
frame .randopt.f2
    checkbutton .randopt.f2.parallels -text "Allow Parallel Arcs" \
        -variable goblinRandParallels -anchor w
    pack .randopt.f2.parallels -side top -fill x
     
frame .randopt.f3
    label .randopt.f3.minText -text "Minimum Label:" -anchor w
    grid .randopt.f3.minText -in .randopt.f3  \
        -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    entry .randopt.f3.minimum -textvariable goblinRandMin -bg white -width 5
    grid .randopt.f3.minimum -in .randopt.f3 \
        -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m

    label .randopt.f3.maxText -text "Maximum Label:" -anchor w
    grid .randopt.f3.maxText -in .randopt.f3  \
        -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    entry .randopt.f3.maximum -textvariable goblinRandMax -bg white -width 5
    grid .randopt.f3.maximum -in .randopt.f3 \
        -row 1 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m

    grid rowconfig    .randopt.f3 0 -weight 1 -minsize 0
    grid columnconfig .randopt.f3 0 -weight 1 -minsize 0
    
frame .randopt.buttons
    button .randopt.buttons.apply -text "Apply" -command {
        if {[QualifiedInt $goblinRandMin 0 50000] && [QualifiedInt $goblinRandMax 0 50000]} {
            if {$goblinRandLength==1} {$ThisGraph generate length}
            if {$goblinRandUCap==1} {$ThisGraph generate ucap}
            if {$goblinRandLCap==1} {$ThisGraph generate lcap}
            if {$goblinRandGeometry==1} {$ThisGraph generate geometry}
            InitDisplay
            destroy .randopt
        }
    }
    
    button .randopt.buttons.done -text "Done" -command {
        if {[QualifiedInt $goblinRandMin 0 50000] && [QualifiedInt $goblinRandMax 0 50000]} {
            destroy .randopt
        }
    }
    
    pack .randopt.buttons.apply .randopt.buttons.done \
        -side left -fill x -padx 3m
     
pack .randopt.buttons -padx 3m -pady 3m -side bottom
pack .randopt.f1 .randopt.f2 .randopt.f3 -padx 10m -pady 5m -side top -anchor w
