# OpenVerse KDE style panel version 0.2 # # This is the KDE pannel. It adds a completly new look to the OpenVerse ! # # Module Name - KDE Panel # Current Maintainter - Tim Trainor # Sourced By - Init Module # # Copyright (C) 1999 Tim Trainor # For more information visit http://OpenVerse.org/contrib/ # For information on OpenVerse visit http://OpenVerse.org/ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # clean up the window... if {[winfo exists .menu.main]} {destroy .menu.main} foreach w [winfo children .menu] { destroy $w } if {[winfo exists .bottomPanel]} {destroy .bottomPanel} if {[winfo exists .top.right]} {destroy .top.right} # make a dummy frame so we can bind to its event so we don't # break other panel configurations frame .menu.main bind .menu.main KDE.unload frame .menu.plugins set MV(use_windowmanager_colors) 1 set tk_strictMotif 1 # create our images... image create bitmap vhandle -file $MV(icondir)/vhandle.xbm -maskfile $MV(icondir)/vhandle.mask -background gray90 image create bitmap hhandle -file $MV(icondir)/hhandle.xbm -maskfile $MV(icondir)/hhandle.mask -background gray90 proc darken {color} { set rgb [winfo rgb . $color] return [format "#%02x%02x%02x" \ [expr round([lindex $rgb 0] * .80)] \ [expr round([lindex $rgb 1] * .80)] \ [expr round([lindex $rgb 2] * .80)]] } # set up KDE colors --- set MV(KDE.basecolor) [. cget -bg] entry .temporaryentrywidget set MV(KDE.highlightcolor) [.temporaryentrywidget cget -selectbackground] set MV(KDE.textbackground) [.temporaryentrywidget cget -background] destroy .temporaryentrywidget option add *troughColor [darken $MV(KDE.basecolor)] option add *selectColor [darken $MV(KDE.basecolor)] option add *selectBackground $MV(KDE.highlightcolor) option add *selectBorderWidth 0 option add *Scrollbar.width 13 option add *Scrollbar.elementBorderWidth 2 option add *Scrollbar.borderWidth 1 # basic procedures... proc unique {} { global Unique if !{[info exists Unique]} {set Unique 0} return [incr Unique] } proc KDE.unload {} { global MV # destroy all our frames... destroy [.menu.menubar widget] destroy [.menu.buttonbar widget] destroy .top.side # unregister our plugin callback set index [lsearch -exact $MV(plugin.traps.ProcessInput.post) KDE] set MV(plugin.traps.ProcessInput.post) [lreplace $MV(plugin.traps.ProcessInput.post) $index $index] unset MV(plugin.traps.ProcessInput.post.KDE) } # set up some frames pack forget .top.c pack [frame .top.right] -side right -fill y pack .top.c frame .bottomPanel pack .bottomPanel -side bottom -fill x # Text chat window with entry pack [frame .bottomPanel.display] -fill both -expand 1 text .bottomPanel.display.text -height 7 -yscrollcommand {.bottomPanel.display.ys set} -state disabled -wrap word set t .bottomPanel.display.text $t tag configure italic -font {helvetica 12 italic} $t tag configure bold -font {helvetica 12 bold} $t tag configure blue -foreground blue $t tag configure green -foreground darkgreen $t tag configure grey -foreground grey60 $t tag configure red -foreground red proc KDE.showChat {raw cmd parms rest} { global MV set t .bottomPanel.display.text # first, lets ignore things we won't display if {[regexp {AVATAR|DCC*|EXIT*|MOVE|PING|PUSH|ROOM*|SUB*|TOOBIG|BOX|LINK|MOUSE*|ABOVE|TELL|IMAGE|TEXT|ENTRY} $cmd]} { return 1} set who [lindex $parms 0] $t configure -state normal switch $cmd { CHAT {$t insert end "$who: " {bold} $rest\n } PRIVMSG {$t insert end "$who: $rest\n" {bold blue}} NEW {$t insert end "$who has joined $MV(roomname)\n" italic} NOMORE {$t insert end "$who has left $MV(roomname)\n" italic} SCHAT {$t insert end "$parms $rest\n" italic} EFFECT {$t insert end "$parms $rest\n" italic} } $t yview scroll 1 units $t configure -state disabled return 1 } scrollbar .bottomPanel.display.ys -orient vert -command {.bottomPanel.display.text yview} pack .bottomPanel.display.ys -side right -fill y pack .bottomPanel.display.text -fill both -expand 1 button .bottomPanel.cb ; # dummy button for connect, OV wants to change its text button .bottomPanel.send -text Send -command SendText button .bottomPanel.jump -text J -command {SendToServer "EFFECT jump"} button .bottomPanel.shiver -text S -command {SendToServer "EFFECT shiver"} entry .bottomPanel.chat -bg white pack .bottomPanel.send .bottomPanel.jump .bottomPanel.shiver -side right pack .bottomPanel.chat -fill x bind .bottomPanel.chat SendText bind .bottomPanel.chat "ShowPrev .bottomPanel.chat" bind .bottomPanel.chat "ShowNext .bottomPanel.chat" bind .bottomPanel.chat "CheckLen .bottomPanel.chat" focus .bottomPanel.chat # KDE toolbar widget proc Ktoolbar {name args} { global MV upvar #0 $name self set self(children) [list] set self(state) show set end [expr [llength [split $name .]] - 2] set self(parent) [join [lrange [split $name .] 0 $end] .] if {$self(parent) == ""} {set self(parent) .} set self(widget) [frame $self(parent).toolbar[unique] -class Toolbar] set self(handle) [label $self(widget).handle -image vhandle -relief raised -bd 1] update idletasks set self(frame) [frame $self(widget).frame -relief raised -bd 1] pack propagate $self(frame) 0 pack $self(handle) -side left -fill y pack $self(frame) -in $self(widget) -fill both -expand 1 bind $self(handle) "$self(handle) configure -bg $MV(KDE.highlightcolor)" bind $self(handle) "$self(handle) configure -bg $MV(KDE.basecolor)" bind $self(handle) "::Ktoolbar::showHide $name" uplevel #0 "proc $name {args} {::Ktoolbar::\[lindex \$args 0\] $name \[lrange \$args 1 end\]}" return $name } namespace eval ::Ktoolbar { proc show {name args} { upvar #0 $name self pack $self(widget) -in $self(parent) -side top -fill x return } proc widget {name args} { upvar #0 $name self return $self(widget) } proc frame {name args} { upvar #0 $name self return $self(frame) } proc state {name args} { upvar #0 $name self return $self(state) } proc children {name args} { upvar #0 $name self return $self(children) } proc parent {name args} { upvar #0 $name self return $self(parent) } proc add {name w args} { upvar #0 $name self if {[winfo class $w] == "Menubutton" && [regexp -nocase {^help$} [$w cget -text]]} {pack $w -in $self(frame) -side right} { pack $w -in $self(frame) -side left } lappend $self(children) $w return } proc del {name w args} { upvar #0 $name self set index [lsearch -exact $self(children) $w] if {$index < 0} {return} pack forget $w set self(children) [lreplace $self(children) $index $index] return } proc showHide {name args} { upvar #0 $name self switch $self(state) { show { pack forget $self(frame) $self(handle) configure -image hhandle set self(state) hide return } hide { $self(handle) configure -image vhandle pack $self(frame) -fill both -expand 1 set self(state) show return } } } } Ktoolbar .menu.menubar .menu.menubar show Ktoolbar .menu.buttonbar .menu.buttonbar show set MenuBar [.menu.menubar widget] set ButtonBar [.menu.buttonbar widget] # OpenVerse menu menubutton $MenuBar.ov -text "OpenVerse" -underline 0 -menu $MenuBar.ov.menu menu $MenuBar.ov.menu -tearoff 0 $MenuBar.ov.menu add command -label Connect -underline 0 -command Connect $MenuBar.ov.menu add cascade -label Passageways -menu $MenuBar.ov.menu.m menu $MenuBar.ov.menu.m -tearoff 0 $MenuBar.ov.menu add command -label "Text Chat" -command ToggleText $MenuBar.ov.menu add command -label Setup -command Setup $MenuBar.ov.menu add checkbutton -label Sound -variable MV(bell) $MenuBar.ov.menu add separator $MenuBar.ov.menu add command -label Exit -underline 1 -command exit # Avatar menu menubutton $MenuBar.av -text "Avatars" -underline 0 -menu $MenuBar.av.menu menu $MenuBar.av.menu -tearoff 0 $MenuBar.av.menu add checkbutton -label Animate -variable MV(anim.stop) -command AnimateAvatar \ -offvalue 1 -onvalue 0 $MenuBar.av.menu add cascade -label Avatars -menu $MenuBar.av.menu.m menu $MenuBar.av.menu.m -tearoff 0 $MenuBar.av.menu add separator $MenuBar.av.menu add command -label "Avatar Editor (AvEd)" -command AvEd # Users menu menubutton $MenuBar.u -text "Users" -underline 0 -menu $MenuBar.u.menu menu $MenuBar.u.menu -tearoff 0 $MenuBar.u.menu add checkbutton -label "Show Name Tags" -variable MV(names) -command ShowNames $MenuBar.u.menu add cascade -label Names -menu $MenuBar.u.menu.m menu $MenuBar.u.menu.m -tearoff 0 # View menu menubutton $MenuBar.v -text "View" -underline 0 -menu $MenuBar.v.menu menu $MenuBar.v.menu -tearoff 0 $MenuBar.v.menu add checkbutton -label Menubar -variable MV(view.menubar) -command KDE.viewmenubar $MenuBar.v.menu add checkbutton -label Toolbar -variable MV(view.toolbar) -command KDE.viewtoolbar $MenuBar.v.menu add checkbutton -label "Side Panel" -variable MV(view.sidebar) -command KDE.viewsidebar $MenuBar.v.menu add checkbutton -label "Text Chat" -variable MV(view.textchat) -command KDE.viewchat # Help menu menubutton $MenuBar.h -text Help -underline 0 -menu $MenuBar.h.menu menu $MenuBar.h.menu -tearoff 0 $MenuBar.h.menu add command -label "About OpenVerse" -command \ "source \"$MV(helpdir)/$MV(help.file.about)\"" $MenuBar.h.menu add command -label "OpenVerse Help" -command \ "source \"$MV(helpdir)/$MV(help.file.main)\"" $MenuBar.h.menu add command -label "Technical Documentation" -command \ "source \"$MV(helpdir)/$MV(help.file.technical)\"" proc KDE.viewmenubar {} { global MV if {$MV(view.menubar)} {pack forget [.menu.menubar widget]} { pack [.menu.menubar widget] -side top -fill x] } } proc KDE.viewtoolbar {} { global MV if {$MV(view.toolbar)} {pack forget [.menu.buttonbar widget]} { pack [.menu.buttonbar widget] -side top -fill x} } proc KDE.viewchat {} { global MV if {$MV(view.textchat)} {pack forget .bottomPanel.display} { pack .bottomPanel.display -side top -fill x} } proc KDE.viewsidebar {} { global MV if {$MV(view.sidebar)} {pack forget .top.right} {pack .top.right -side right -fill y} } .menu.menubar add $MenuBar.ov .menu.menubar add $MenuBar.av .menu.menubar add $MenuBar.v .menu.menubar add $MenuBar.u .menu.menubar add $MenuBar.h set MV(names_menu) $MenuBar.u.menu set MV(avatar_menu) $MenuBar.av.menu set MV(passageways_menu) $MenuBar.ov.menu DoAvatars DoBookmarks DoNames set MV(connect_button) .bottomPanel.cb set MV(chat_entry) .bottomPanel.chat set MV(plugin_frame) [.menu.buttonbar frame] # hook into the callback lappend MV(plugin.traps.ProcessInput.post) KDE set MV(plugin.traps.ProcessInput.post.KDE) KDE.showChat