# OpenVerse NotFun Panel
# 
# this file initalizes the program and does any
# platform specific things/setup. It will then source 
# supporting modules.
#
# Module Name		- NotFun Panel Setup
# Current Maintainter 	- Cruise <cruise@openverse.org>
# Sourced By		- InitMain.tcl
#
# Copyright (C) 1999 David Gale <cruise@openverse.org>
# For more information 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.

set MV(plugin_frame) ".menu.main.plugins"
set MV(connect_button) ".menu.main.m.connect"
set MV(chat_entry) ".menu.main.chat.chat"
set MV(names_menu) ".menu.main.m.names.m"
set MV(avatar_menu) ".menu.main.m.av.m"
set MV(passageways_menu) ".menu.main.m.ov.m"

if [winfo exists .menu.main] {destroy .menu.main}

frame .menu.main
frame .menu.main.m
frame .menu.main.chat -relief sunken -borderwidth 2
frame .menu.main.plugins

menubutton .menu.main.m.ov -text OpenVerse -menu .menu.main.m.ov.m 
menu .menu.main.m.ov.m
.menu.main.m.ov.m add cascade -label Passageways -menu .menu.main.m.ov.m.m
menu .menu.main.m.ov.m.m
.menu.main.m.ov.m add command -label "Text Chat" -command ToggleText
.menu.main.m.ov.m add command -label "Setup" -command Setup
.menu.main.m.ov.m add checkbutton -label Sound -variable MV(bell)
.menu.main.m.ov.m add separator
.menu.main.m.ov.m add command -label Quit -command exit

menubutton .menu.main.m.av -text Avatars -menu .menu.main.m.av.m 
menu .menu.main.m.av.m
.menu.main.m.av.m add checkbutton -label Animate -variable MV(anim.stop) \
	-command AnimateAvatar -offvalue 1 -onvalue 0 
.menu.main.m.av.m add cascade -label Avatars -menu .menu.main.m.av.m.m
menu .menu.main.m.av.m.m
.menu.main.m.av.m add separator
.menu.main.m.av.m add command -label "Avatar Editor (AvEd)" -command AvEd

menubutton .menu.main.m.names -text Users -menu .menu.main.m.names.m 
menu .menu.main.m.names.m
.menu.main.m.names.m add checkbutton -label "Show NameTags" \
	 -variable MV(names) -command ShowNames
.menu.main.m.names.m add cascade -label Names -menu .menu.main.m.names.m.m
menu .menu.main.m.names.m.m

button .menu.main.m.connect -text Connect -command Connect -relief flat \
	-borderwidth 0

button .menu.main.m.help -text Help -relief flat \
	-command "source \"$MV(helpdir)/OpenVerse.ohlp\"" -borderwidth 0

button .menu.main.chat.send -text Send -command SendText 
entry .menu.main.chat.chat

pack .menu.main -side top -fill both -expand y 
pack .menu.main.m .menu.main.chat -side left -fill x -expand y
pack .menu.main.plugins -side right
pack .menu.main.chat.send -side left
pack .menu.main.chat.chat -side left -fill both -expand y
pack .menu.main.m.ov .menu.main.m.av .menu.main.m.names \
	.menu.main.m.connect .menu.main.m.help -side left -fill both -expand y

bind .menu.main.chat.chat <Return> SendText
bind .menu.main.chat.chat <Up> "ShowPrev .menu.main.chat.chat"
bind .menu.main.chat.chat <Down> "ShowNext .menu.main.chat.chat"
bind .menu.main.chat.chat <Key> "CheckLen .menu.main.chat.chat"

focus .menu.main.chat.chat

proc ColorMainButtons {} {
	global MV

	if $MV(use_windowmanager_colors) {return}
}

DoAvatars
DoBookmarks
DoNames
ColorMainButtons
