+ global all_heads current_branch
+ global create_branch_checkout create_branch_revtype create_branch_head
+
+ set create_branch_checkout true
+ set create_branch_revtype head
+ set create_branch_head $current_branch
+
+ set w .branch_editor
+ toplevel $w
+ wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
+
+ label $w.header -text {Create New Branch} \
+ -font font_uibold
+ pack $w.header -side top -fill x
+
+ frame $w.buttons
+ button $w.buttons.create -text Create \
+ -font font_ui \
+ -default active \
+ -command [list do_create_branch_action $w]
+ pack $w.buttons.create -side right
+ button $w.buttons.cancel -text {Cancel} \
+ -font font_ui \
+ -command [list destroy $w]
+ pack $w.buttons.cancel -side right -padx 5
+ pack $w.buttons -side bottom -fill x -pady 10 -padx 10
+
+ labelframe $w.name \
+ -text {Branch Description} \
+ -font font_ui
+ label $w.name.l -text {Name:} -font font_ui
+ text $w.name.t \
+ -height 1 \
+ -width 40 \
+ -font font_ui
+ bind $w.name.t <Shift-Key-Tab> "focus $w.postActions.checkout;break"
+ bind $w.name.t <Key-Tab> "focus $w.from.exp.t;break"
+ bind $w.name.t <Key-Return> "do_create_branch_action $w;break"
+ bind $w.name.t <Key> {
+ if {{%K} ne {BackSpace}
+ && {%K} ne {Tab}
+ && {%K} ne {Escape}
+ && {%K} ne {Return}} {
+ if {%k <= 32} break
+ if {[string first %A {~^:?*[}] >= 0} break
+ }
+ }
+ pack $w.name.l -side left -padx 5
+ pack $w.name.t -side left -fill x -expand 1
+ pack $w.name -anchor nw -fill x -pady 5 -padx 5
+
+ labelframe $w.from \
+ -text {Starting Revision} \
+ -font font_ui
+ frame $w.from.head
+ radiobutton $w.from.head.r \
+ -text {Local Branch:} \
+ -value head \
+ -variable create_branch_revtype \
+ -font font_ui
+ eval tk_optionMenu $w.from.head.m create_branch_head $all_heads
+ pack $w.from.head.r -side left
+ pack $w.from.head.m -side left
+ frame $w.from.exp
+ radiobutton $w.from.exp.r \
+ -text {Revision Expression:} \
+ -value expression \
+ -variable create_branch_revtype \
+ -font font_ui
+ text $w.from.exp.t \
+ -height 1 \
+ -width 50 \
+ -font font_ui
+ bind $w.from.exp.t <Shift-Key-Tab> "focus $w.name.t;break"
+ bind $w.from.exp.t <Key-Tab> "focus $w.postActions.checkout;break"
+ bind $w.from.exp.t <Key-Return> "do_create_branch_action $w;break"
+ pack $w.from.exp.r -side left
+ pack $w.from.exp.t -side left -fill x -expand 1
+ pack $w.from.head -padx 5 -fill x -expand 1
+ pack $w.from.exp -padx 5 -fill x -expand 1
+ pack $w.from -anchor nw -fill x -pady 5 -padx 5
+
+ labelframe $w.postActions \
+ -text {Post Creation Actions} \
+ -font font_ui
+ checkbutton $w.postActions.checkout \
+ -text {Checkout after creation} \
+ -offvalue false \
+ -onvalue true \
+ -variable create_branch_checkout \
+ -font font_ui
+ pack $w.postActions.checkout -anchor nw
+ pack $w.postActions -anchor nw -fill x -pady 5 -padx 5
+
+ bind $w <Visibility> "grab $w; focus $w.name.t"
+ bind $w <Key-Escape> "destroy $w"
+ bind $w <Key-Return> "do_create_branch_action $w;break"
+ wm title $w "[appname] ([reponame]): Create Branch"
+ tkwait window $w