
#-------------------------------------------------------------------------------
# Module:     editExtract.tk
# Activation: Dynamically loaded on user request
# Scope:      Extract potential solutions from other data structures
#-------------------------------------------------------------------------------



proc ExtractSolutions {} {
    global WDExtract DefPadX

    set title "Extract Solutions"

    if {[RegisterFormOrWindow $title extract WDExtract ExtractSolutions \
            "Cancel"        {} \
            "Go"            {
                $ThisGraph extract $ThisStructure
                PropagateModifications
            } \
            ""              {} \
            ""              {} \
        ]
    } {
        return
    }


    global ThisGraph ThisStructure
    if {![info exists ThisStructure] || \
            ($ThisStructure!="trees" && $ThisStructure!="bipartition" && \
             $ThisStructure!="cut" && $ThisStructure!="matching" && \
             $ThisStructure!="colours" && $ThisStructure!="cycles")} {
        set ThisStructure "trees"
    }

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

    label $WDExtract.options.label -text "Desired Structure:" -anchor w
    radiobutton $WDExtract.options.trees -text "Trees" \
        -variable ThisStructure -value "trees" -anchor w
    radiobutton $WDExtract.options.cut -text "Cut" \
        -variable ThisStructure -value "cut" -anchor w
    radiobutton $WDExtract.options.bipartition -text "Bipartition" \
        -variable ThisStructure -value "bipartition" -anchor w
    radiobutton $WDExtract.options.colours -text "Colours" \
        -variable ThisStructure -value "colours" -anchor w
    radiobutton $WDExtract.options.matching -text "Matching" \
        -variable ThisStructure -value "matching" -anchor w
    radiobutton $WDExtract.options.cycles -text "Cycles" \
        -variable ThisStructure -value "cycles" -anchor w
    pack $WDExtract.options.label $WDExtract.options.trees \
        $WDExtract.options.cut $WDExtract.options.bipartition \
        $WDExtract.options.colours $WDExtract.options.matching \
        $WDExtract.options.cycles -side top -fill x


    DisplayForm $title
}

ExtractSolutions
