
#-------------------------------------------------------------------------------
# Module:     layoutStyle.tk
# Activation: Dynamically loaded on user request
# Scope:      Application of basic layout methods
#-------------------------------------------------------------------------------



proc LayoutStyle {} {
    global ThisGraph GoCommand UploadCommand WDInput InternalWindowing Mode
    
    set GoCommand {
        if {$goblinNodeSep>0} {
            $ThisGraph layout $ThisLabel
            set Mode "display object"
            PropagateModifications
        }
    }
    set UploadCommand {}
    
    DisplayInputDialog "Layout Style" "LayoutStyle" "Draw" "Done" {
        global ThisGraph ThisLabel goblinNodeSep DefPadX

        if {![info exists ThisLabel] ||
            ($ThisLabel!="tree" && $ThisLabel!="circle" && \
             $ThisLabel!="grid" && $ThisLabel!="colours"     )} {
               set ThisLabel "tree"
        }

        frame $WDInput.options
        label $WDInput.options.label -text "Layout Style:" -anchor w
        radiobutton $WDInput.options.tree -text "Align Predecessor Tree" \
            -variable ThisLabel -value "tree" -anchor w
        radiobutton $WDInput.options.circle -text "Place Nodes on a Circle" \
            -variable ThisLabel -value "circle" -anchor w
        radiobutton $WDInput.options.colours -text "Arrange Colours into Rows" \
            -variable ThisLabel -value "colours" -anchor w
        radiobutton $WDInput.options.grid -text "Square Grid" \
            -variable ThisLabel -value "grid" -anchor w
        pack $WDInput.options.label $WDInput.options.tree \
            $WDInput.options.circle $WDInput.options.colours \
            $WDInput.options.grid -side top -fill x

        pack $WDInput.options -padx $DefPadX -pady 5m -side top -anchor w
     
        label $WDInput.frame.label -text "Node Separator:" -anchor w
        entry $WDInput.frame.entry -textvariable goblinNodeSep -bg white -width 5
        pack $WDInput.frame.label $WDInput.frame.entry -side left -padx 1m -fill x
    }
    
    focus $WDInput.frame.entry
}

if {![info exists WDOptLevel] || ![winfo exists $WDOptLevel]} {LayoutStyle}
