
destroy .measures
toplevel .measures
wm title .measures "GOBLIN Layout Options"
wm resizable .measures 0 0

    
frame .measures.buttons
pack .measures.buttons -padx 5m -pady 3m -side bottom

    button .measures.buttons.adjust -text "Fit into Window" \
        -command FitIntoWindow

    button .measures.buttons.apply -text "Apply" -command { \
        if {[QualifiedInt $goblinLegenda 0 50000] && \
            [QualifiedInt $goblinNodeSize 1 50000] && \
            [QualifiedInt $goblinNodeSep 1 50000] && \
            [QualifiedInt $goblinArrowSize 1 50000]} {
            InitDisplay
        }
    }
    
    button .measures.buttons.done -text "Done" -command { \
        if {[QualifiedInt $goblinLegenda 0 50000] && \
            [QualifiedInt $goblinNodeSize 1 50000] && \
            [QualifiedInt $goblinNodeSep 1 50000] && \
            [QualifiedInt $goblinArrowSize 1 50000]} {
            destroy .measures
            InitDisplay
        }
    }    
    
    pack .measures.buttons.adjust .measures.buttons.apply \
    	.measures.buttons.done -side left -fill x -padx 3m


frame .measures.frame3
pack .measures.frame3 -padx 5m -pady 3m -side bottom -anchor w

    
frame .measures.frame
pack .measures.frame -padx 5m -pady 3m -side left -anchor w
    
    label .measures.frame.x -text "x" -anchor n
    grid .measures.frame.x -in .measures.frame \
        -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    label .measures.frame.y -text "y" -anchor n
    grid .measures.frame.y -in .measures.frame \
        -row 0 -column 2 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    
    label .measures.frame.zoomText -text "Zoom Factor:" -anchor w
    grid .measures.frame.zoomText -in .measures.frame \
        -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.xZoom -textvariable goblinXZoom -bg white -width 5
    grid .measures.frame.xZoom -in .measures.frame \
        -row 1 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.yZoom -textvariable goblinYZoom -bg white -width 5
    grid .measures.frame.yZoom -in .measures.frame \
        -row 1 -column 2 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    
    label .measures.frame.shiftText -text "Shift:" -anchor w
    grid .measures.frame.shiftText -in .measures.frame \
        -row 2 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.xShift -textvariable goblinXShift -bg white -width 5
    grid .measures.frame.xShift -in .measures.frame \
        -row 2 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.yShift -textvariable goblinYShift -bg white -width 5
    grid .measures.frame.yShift -in .measures.frame \
        -row 2 -column 2 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m

    label .measures.frame.nodeText -text "Node Size:" -anchor w
    grid .measures.frame.nodeText -in .measures.frame \
        -row 1 -column 4 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.nodeSize -textvariable goblinNodeSize -bg white -width 5
    grid .measures.frame.nodeSize -in .measures.frame \
        -row 1 -column 5 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    
    label .measures.frame.arrowText -text "Arrow Size:" -anchor w
    grid .measures.frame.arrowText -in .measures.frame \
        -row 2 -column 4 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.arrowSize -textvariable goblinArrowSize -bg white -width 5
    grid .measures.frame.arrowSize -in .measures.frame \
        -row 2 -column 5 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
	
    frame .measures.frame.dummy 
    grid .measures.frame.dummy -in .measures.frame \
        -row 3 -column 3 -rowspan 1 -columnspan 1 -sticky news -padx 20

    label .measures.frame.sepText2 -text "Node Separator: " -anchor w
    grid .measures.frame.sepText2 -in .measures.frame \
        -row 3 -column 4 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.sepNode -textvariable goblinNodeSep -bg white -width 5
    grid .measures.frame.sepNode -in .measures.frame \
        -row 3 -column 5 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m

    label .measures.frame.legendaText -text "Legenda:    " -anchor w
    grid .measures.frame.legendaText -in .measures.frame \
        -row 4 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    radiobutton .measures.frame.legenda -text "Hide" \
        -variable goblinLegenda -value 0 -anchor w
    grid .measures.frame.legenda -in .measures.frame \
        -row 4 -column 1 -rowspan 1 -columnspan 2 -sticky news -padx 1m -pady 1m
    label .measures.frame.sepText -text "Separator: " -anchor w
    grid .measures.frame.sepText -in .measures.frame \
        -row 4 -column 4 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m
    entry .measures.frame.sepLegenda -textvariable goblinLegenda -bg white -width 5
    grid .measures.frame.sepLegenda -in .measures.frame \
        -row 4 -column 5 -rowspan 1 -columnspan 1 -sticky news -padx 1m -pady 1m

    grid rowconfig    .measures.frame 0 -weight 1 -minsize 0
    grid columnconfig .measures.frame 0 -weight 1 -minsize 0



bind .measures.frame.xZoom <Return> {focus .measures.frame.yZoom}
bind .measures.frame.yZoom <Return> {focus .measures.frame.xShift}
bind .measures.frame.xShift <Return> {focus .measures.frame.yShift}
bind .measures.frame.yShift <Return> {focus .measures.frame.nodeSize}
bind .measures.frame.nodeSize <Return> {
    if {[QualifiedInt goblinNodeSize 1 50000]} {
        focus .measures.frame.arrowSize
    }
}
bind .measures.frame.arrowSize <Return> {
    if {[QualifiedInt goblinArrowSize 1 50000]} {
        focus .measures.frame.sepNode
    }
}
bind .measures.frame.sepNode <Return> {
    if {[QualifiedInt $goblinNodeSep 0 50000] && \
        focus .measures.frame.sepLegenda
    }
}
bind .measures.frame.sepLegenda <Return> {
    if {[QualifiedInt $goblinLegenda 0 50000] && \
        [QualifiedInt $goblinNodeSize 1 50000] && \
        [QualifiedInt $goblinNodeSep 1 50000] && \
        [QualifiedInt $goblinArrowSize 1 50000]} {
        destroy .measures
        InitDisplay
    }
}
    
focus .measures.frame.xZoom
