Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc ::skin::potato::show {c} {
- variable widgets;
- variable opts;
- ::skin::potato::worldBar $c
- ::skin::potato::spawnBar $c
- set input1 [::potato::connInfo $c input1]
- set input2 [::potato::connInfo $c input2]
- pack $input1 -in $widgets(pane,btm,pane,top) -side left -expand 1 -fill both -anchor nw
- pack $input2 -in $widgets(pane,btm,pane,btm) -side left -expand 1 -fill both -anchor nw
- $input1 configure -yscrollcommand [list $widgets(pane,btm,pane,top,sb) set]
- $widgets(pane,btm,pane,top,sb) configure -command [list $input1 yview]
- $input2 configure -yscrollcommand [list $widgets(pane,btm,pane,btm,sb) set]
- $widgets(pane,btm,pane,btm,sb) configure -command [list $input2 yview]
- $widgets(pane,top) configure -background [::potato::connInfo $c top,bg]
- $widgets(conn,$c,txtframe) configure -background [::potato::connInfo $c top,bg]
- $widgets(pane,btm,idle) configure -background [::potato::connInfo $c bottom,bg] \
- -foreground [::potato::connInfo $c bottom,fg] -font [::potato::connInfo $c bottom,font]
- set btm(font) [::potato::connInfo $c bottom,font]
- set btm(fg) [::potato::connInfo $c bottom,fg]
- set btm(bg) [::potato::connInfo $c bottom,bg]
- set btm(insert) [::potato::reverseColour $btm(bg)]
- if { $c == 0 && !$::potato::misc(connZeroInputWindows) } {
- $widgets(pane) paneconfigure $widgets(pane,btm) -hide 1
- } else {
- $widgets(pane) paneconfigure $widgets(pane,btm) -hide 0
- }
- if { [info exists widgets(conn,$c,withInput)] } {
- focus $widgets(conn,$c,withInput)
- } else {
- focus [set input[::potato::connInfo $c inputFocus]]
- }
- update idletasks
- pack $widgets(conn,$c,txtframe) -in $widgets(pane,top) -side top -expand 1 -fill both -anchor nw -pady 0 -padx [list 3 0]
- pack $widgets(conn,$c,txtframe,sbX) -in $widgets(pane,top) -side bottom -expand 0 -fill x -anchor sw
- fixWindowOrder $c
- if { $c == 0 } {
- $widgets(statusbar,worldname,label) configure -text $::potato::potato(name)
- $widgets(statusbar,hostinfo,label) configure -text [::potato::T "Not Connected"]
- $widgets(statusbar,connstatus,sub,msg) configure -text [::potato::T "Not Connected"] -image {}
- $widgets(statusbar,worldname,label,prompt) configure -textvariable ""
- } else {
- $widgets(statusbar,worldname,label) configure -text "$c. [potato::connInfo $c connname]"
- $widgets(statusbar,hostinfo,label) configure -text "[potato::connInfo $c host]:[potato::connInfo $c port]"
- $widgets(statusbar,worldname,label,prompt) configure -textvariable ::potato::conn($c,prompt)
- }
- $widgets(statusbar,connstatus,sub,time) configure -textvariable ::potato::conn($c,stats,formatted)
- updateTaskButtons
- return;
- };# ::skin::potato::show
- proc ::skin::potato::import {c} {
- variable widgets;
- set t [::potato::connInfo $c text]
- set widgets(conn,$c,txtframe) [frame $widgets(pane,top).txtframe-$c]
- set widgets(conn,$c,txtframe,cmd) ::skin::potato::conn_${c}_txtframe_cmd
- rename $widgets(conn,$c,txtframe) $widgets(conn,$c,txtframe,cmd)
- proc ::$widgets(conn,$c,txtframe) {first args} [string map [list CONNID $c] {
- if { $first == "yview" } {
- [::skin::potato::activeTextWidget CONNID] yview {*}$args
- } else {
- ::skin::potato::conn_CONNID_txtframe_cmd $first {*}$args
- }
- }]
- set widgets(conn,$c,txtframe,sb) [::ttk::scrollbar $widgets(conn,$c,txtframe).sb -orient vertical]
- pack $widgets(conn,$c,txtframe,sb) -side right -fill y -anchor ne
- set widgets(conn,$c,txtframe,sbX) [::ttk::scrollbar $widgets(pane,top).sbX-$c -orient horizontal -command [list $t xview]]
- $t config -xscrollcommand [list $widgets(conn,$c,txtframe,sbX) set]
- bind $widgets(conn,$c,txtframe) <MouseWheel> [list ::skin::potato::scrollActiveTextWidget $c %D]
- bind $widgets(conn,$c,txtframe) <Button-4> [list ::skin::potato::scrollActiveTextWidget $c 120]
- bind $widgets(conn,$c,txtframe) <Button-5> [list ::skin::potato::scrollActiveTextWidget $c -120]
- bind $widgets(conn,$c,txtframe) <Button-3> [list ::skin::potato::rightclickOutput $c "" %x %y %X %Y]
- bind $t <Button-3> [list ::skin::potato::rightclickOutput $c $t %x %y %X %Y]
- foreach x [::potato::connInfo $c spawns] {
- addSpawn $c $x
- }
- showSpawn $c ""
- return;
- };# ::skin::potato::import
- proc ::skin::potato::unshow {c} {
- variable widgets;
- variable spawns;
- set input1 [::potato::connInfo $c input1]
- set input2 [::potato::connInfo $c input2]
- set widgets(conn,$c,withInput) [set input[::potato::connInfo $c inputFocus]]
- $input1 configure -yscrollcommand ""
- $widgets(pane,btm,pane,top,sb) configure -command ""
- $input2 configure -yscrollcommand ""
- $widgets(pane,btm,pane,btm,sb) configure -command ""
- pack forget $widgets(conn,$c,txtframe) $input1 $input2 $widgets(conn,$c,txtframe,sbX)
- catch {wm withdraw $widgets(conn,$c,find)}
- catch {destroy {*}[winfo children $widgets(spawnbar)]}
- worldBarButtonNames
- array unset spawns $c,*
- return;
- };# ::skin::potato::unshow
- ::potato::define_slash_cmd wrap {
- variable conn;
- set t [::potato::connInfo $c text]
- set wrap [$t cget -wrap]
- if { $wrap eq "word" } {
- $t configure -wrap none
- pack $t -expand 1 -fill both
- } else {
- $t configure -wrap word
- pack $t -expand 0 -fill y
- }
- return [list 1];
- };# /wrap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement