
#    TkDesk - a file manager for Unix and the X Window System
#    Copyright (C) 1996  Christian Bolik
#
#    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., 675 Mass Ave, Cambridge, MA 02139, USA.
#    See the file "COPYING" in the base directory of this distribution
#    for more.

#
# =============================================================================
#
#                           START FILE FOR TKDESK
#
# =============================================================================
#

wm withdraw .

#
# ==== Init ===================================================================
#

set tkdesk(version) "1.0b4"
set tkdesk(date) "03.01.97"

# -------------------------------------------------------
# Following is the bitmap used by dsk_welcome:

set tkdesk(welcome_bm) {
#define tkdesk_width 253
#define tkdesk_height 66
static char tkdesk_bits[] = {
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0xf8,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x1f,0x00,0x00,0xe0,0x00,0x00,0x00,
 0x00,0x00,0x00,0xc0,0xff,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x0f,0x00,0x00,0xe0,0x00,
 0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x0f,0x00,0x00,
 0xe0,0x00,0xfe,0xff,0xff,0xff,0xff,0x0f,0xfc,0x07,0x00,0x00,0x00,0xff,0xff,
 0xff,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x0f,
 0x00,0x00,0xe0,0x00,0xfe,0xff,0xff,0xff,0xff,0x07,0xf0,0x07,0x00,0x00,0x00,
 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0xe0,0x0f,0x00,0x00,0xe0,0x00,0xfe,0xff,0xff,0xff,0xff,0x07,0xf0,0x03,0x00,
 0x00,0x00,0xff,0xff,0xff,0xff,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0xe0,0x07,0x00,0x00,0xe0,0x00,0xff,0x00,0xfc,0x01,0xf8,0x07,0xf0,
 0x03,0x00,0x00,0x00,0xc0,0x3f,0x00,0xfc,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xe0,0x07,0x00,0x00,0xe0,0x00,0x3f,0x00,0xfc,0x01,0xe0,
 0x07,0xf8,0x03,0x00,0x00,0x00,0xc0,0x1f,0x00,0xc0,0x3f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x00,0x0f,0x00,0xfc,
 0x01,0xc0,0x07,0xf8,0x03,0x00,0x00,0x00,0xc0,0x1f,0x00,0x00,0xff,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x00,0x07,
 0x00,0xfe,0x00,0x80,0x03,0xf8,0x01,0x00,0x00,0x00,0xc0,0x1f,0x00,0x00,0xfe,
 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0xe0,
 0x80,0x07,0x00,0xfe,0x00,0x80,0x03,0xf8,0x01,0x00,0x00,0x00,0xe0,0x1f,0x00,
 0x00,0xfc,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,
 0x00,0xe0,0x80,0x03,0x00,0xfe,0x00,0x80,0x03,0xfc,0x01,0x00,0x00,0x00,0xe0,
 0x0f,0x00,0x00,0xf8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,
 0x03,0x00,0x00,0xe0,0x80,0x03,0x00,0xfe,0x00,0x80,0x03,0xfc,0x01,0x00,0x00,
 0x00,0xe0,0x0f,0x00,0x00,0xf0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0xf8,0x03,0x00,0x00,0xe0,0x80,0x01,0x00,0xfe,0x00,0x80,0x01,0xfc,0x01,
 0x00,0x00,0x00,0xe0,0x0f,0x00,0x00,0xf0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xf8,0x03,0x00,0x00,0xe0,0x80,0x01,0x00,0x7f,0x00,0x80,0x01,
 0xfc,0x00,0x00,0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0x00,0x00,0xe0,0xc0,0x01,0x00,0x7f,0x00,
 0x80,0x01,0xfc,0x00,0x00,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0x00,0x00,0xe0,0x00,0x00,0x00,
 0x7f,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x1f,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x01,0x00,0x00,0xe0,0x00,
 0x00,0x00,0x7f,0x00,0x00,0x00,0xfe,0x00,0x80,0x0f,0x00,0xf0,0x07,0x00,0x00,
 0xc0,0x1f,0x00,0x00,0xf0,0x07,0x00,0x00,0x7f,0x00,0x00,0xfc,0x01,0x00,0x1f,
 0xe0,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x7e,0x00,0xe0,0x1f,0x00,0xf0,0x07,
 0x00,0x00,0xc0,0x1f,0x00,0x00,0xfe,0x3f,0x00,0xe0,0xff,0x03,0x00,0xfc,0x00,
 0xc0,0x3f,0xe0,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x7e,0x00,0xf0,0x3f,0x00,
 0xf8,0x07,0x00,0x00,0xc0,0x3f,0x00,0xc0,0xff,0x7f,0x00,0xf0,0xff,0x07,0x00,
 0xfc,0x00,0xe0,0x7f,0xe0,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x7f,0x00,0xfc,
 0x3f,0x00,0xf8,0x03,0x00,0x00,0xc0,0x3f,0x00,0xe0,0x07,0xff,0x00,0xf8,0xf0,
 0x0f,0x00,0xfe,0x00,0xf8,0x7f,0xe0,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x7f,
 0x00,0xfe,0x3f,0x00,0xf8,0x03,0x00,0x00,0xc0,0x3f,0x00,0xf8,0x01,0xfe,0x00,
 0x3c,0xe0,0x1f,0x00,0xfe,0x00,0xfc,0x7f,0xe0,0x00,0x00,0x80,0x3f,0x00,0x00,
 0x00,0x3f,0x00,0xff,0x3f,0x00,0xf8,0x03,0x00,0x00,0xc0,0x3f,0x00,0xfc,0x00,
 0xfc,0x01,0x3e,0xc0,0x1f,0x00,0x7e,0x00,0xfe,0x7f,0xe0,0x00,0x00,0xc0,0x1f,
 0x00,0x00,0x00,0x3f,0x80,0xc7,0x1f,0x00,0xf8,0x03,0x00,0x00,0xc0,0x3f,0x00,
 0x7e,0x00,0xfc,0x01,0x1e,0x80,0x1f,0x00,0x7e,0x00,0x8f,0x3f,0xe0,0x00,0x00,
 0xc0,0x1f,0x00,0x00,0x80,0x3f,0xc0,0x01,0x0f,0x00,0xfc,0x01,0x00,0x00,0xc0,
 0x3f,0x00,0x3f,0x00,0xfc,0x01,0x1e,0x80,0x1f,0x00,0x7f,0x80,0x03,0x1e,0xe0,
 0x00,0x00,0xc0,0x1f,0x00,0x00,0x80,0x3f,0xe0,0x00,0x00,0x00,0xfc,0x01,0x00,
 0x00,0xc0,0x3f,0x80,0x1f,0x00,0xfc,0x01,0x1f,0x00,0x1f,0x00,0x7f,0xc0,0x01,
 0x00,0xe0,0x00,0x00,0xc0,0x1f,0x00,0x00,0x80,0x3f,0x70,0x00,0x00,0x00,0xfc,
 0x01,0x00,0x00,0xc0,0x3f,0xc0,0x1f,0x00,0xfc,0x01,0x1f,0x00,0x06,0x00,0x7f,
 0xe0,0x00,0x00,0xe0,0x00,0x00,0xe0,0x0f,0x00,0x00,0x80,0x1f,0x38,0x00,0x00,
 0x00,0xfc,0x01,0x00,0x00,0xc0,0x3f,0xc0,0x0f,0x00,0xfe,0x01,0x3f,0x00,0x00,
 0x00,0x3f,0x70,0x00,0x00,0xe0,0x00,0x00,0xe0,0x0f,0x00,0x00,0xc0,0x1f,0x1c,
 0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0xc0,0x3f,0xe0,0x0f,0x00,0xfe,0x00,0x3f,
 0x00,0x00,0x80,0x3f,0x38,0x00,0x00,0xe0,0x00,0x00,0xe0,0x0f,0x00,0x00,0xc0,
 0x1f,0x0e,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0xe0,0x3f,0xf0,0x07,0x00,0xff,
 0x00,0x7f,0x00,0x00,0x80,0x3f,0x1c,0x00,0x00,0xe0,0x00,0x00,0xe0,0x0f,0x00,
 0x00,0xc0,0x1f,0x07,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0xe0,0x1f,0xf0,0x07,
 0x00,0x7f,0x00,0xff,0x00,0x00,0x80,0x3f,0x0e,0x00,0x00,0xe0,0x00,0x00,0xf0,
 0x07,0x00,0x00,0xc0,0x8f,0x03,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0xe0,0x1f,
 0xf8,0x03,0x80,0x3f,0x00,0xff,0x01,0x00,0x80,0x1f,0x07,0x00,0x00,0xe0,0x00,
 0x00,0xf0,0x07,0x00,0x00,0xc0,0xcf,0x03,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
 0xe0,0x1f,0xf8,0x03,0xc0,0x1f,0x00,0xfe,0x03,0x00,0x80,0x9f,0x07,0x00,0x00,
 0xe0,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0xef,0x07,0x00,0x00,0x00,0x7f,0x00,
 0x00,0x00,0xf0,0x1f,0xf8,0x03,0xf0,0x0f,0x00,0xfe,0x07,0x00,0xc0,0xdf,0x0f,
 0x00,0x00,0xe0,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0xef,0x07,0x00,0x00,0x00,
 0x7f,0x00,0x00,0x00,0xf0,0x0f,0xfc,0x01,0xf8,0x03,0x00,0xfc,0x0f,0x00,0xc0,
 0xdf,0x0f,0x00,0x00,0xe0,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0xf7,0x07,0x00,
 0x00,0x00,0x7f,0x00,0x00,0x00,0xf0,0x0f,0xfc,0x01,0xfe,0x01,0x00,0xf8,0x1f,
 0x00,0xc0,0xef,0x0f,0x00,0x00,0xe0,0x00,0x00,0xf8,0x03,0x00,0x00,0xe0,0xe7,
 0x0f,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0xf8,0x0f,0xfc,0xc1,0x3f,0x00,0x00,
 0xf0,0x3f,0x00,0xc0,0xcf,0x1f,0x00,0x00,0xe0,0x00,0x00,0xf8,0x03,0x00,0x00,
 0xf0,0xe7,0x0f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0xf8,0x07,0xfc,0xf9,0x0f,
 0x00,0x00,0xe0,0x7f,0x00,0xe0,0xcf,0x1f,0x00,0x00,0xe0,0x00,0x00,0xf8,0x03,
 0x00,0x00,0xf0,0xe7,0x0f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0xfc,0x07,0xfe,
 0xff,0x01,0x00,0x00,0xc0,0x7f,0x00,0xe0,0xcf,0x1f,0x00,0x00,0xe0,0x00,0x00,
 0xf8,0x03,0x00,0x00,0xf0,0xc7,0x1f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0xfc,
 0x03,0xfe,0x1f,0x00,0x00,0x00,0x80,0xff,0x00,0xe0,0x8f,0x3f,0x00,0x00,0xe0,
 0x00,0x00,0xfc,0x01,0x00,0x00,0xf0,0xc3,0x1f,0x00,0x00,0x80,0x3f,0x00,0x00,
 0x00,0xfe,0x03,0xfe,0x01,0x00,0x00,0x00,0x00,0xff,0x00,0xe0,0x87,0x3f,0x00,
 0x00,0xe0,0x00,0x00,0xfc,0x01,0x00,0x00,0xf8,0xc3,0x1f,0x00,0x00,0xc0,0x3f,
 0x00,0x00,0x00,0xfe,0x01,0xfe,0x00,0x00,0x00,0x00,0x00,0xfe,0x01,0xf0,0x87,
 0x3f,0x00,0x00,0xe0,0x00,0x00,0xfc,0x01,0x00,0x00,0xf8,0x83,0x3f,0x00,0x00,
 0xc0,0x1f,0x00,0x00,0x00,0xff,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xfc,0x01,
 0xf0,0x07,0x7f,0x00,0x00,0xe0,0x00,0x00,0xfc,0x01,0x00,0x00,0xf8,0x83,0x3f,
 0x00,0x00,0xc0,0x1f,0x00,0x00,0x80,0xff,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
 0xfc,0x01,0xf0,0x07,0x7f,0x00,0x00,0xe0,0x00,0x00,0xfc,0x01,0x00,0x00,0xf8,
 0x01,0x7f,0x00,0x00,0xc0,0x1f,0x00,0x00,0xc0,0x7f,0x00,0xfe,0x00,0x00,0x18,
 0x00,0x00,0xfc,0x01,0xf0,0x03,0xfe,0x00,0x00,0xe0,0x00,0x00,0xfe,0x00,0x00,
 0x00,0xfc,0x01,0x7f,0x00,0x06,0xe0,0x1f,0x00,0x00,0xc0,0x3f,0x00,0xfe,0x00,
 0x00,0x1c,0x78,0x00,0xf8,0x01,0xf8,0x03,0xfe,0x00,0x0c,0xe0,0x00,0x00,0xfe,
 0x00,0x00,0x00,0xfc,0x01,0xff,0x00,0x06,0xe0,0x0f,0x00,0x00,0xf0,0x1f,0x00,
 0xfe,0x01,0x00,0x1e,0x7c,0x00,0xf8,0x01,0xf8,0x03,0xfe,0x01,0x0c,0xe0,0x00,
 0x00,0xfe,0x00,0x00,0x00,0xfc,0x01,0xfe,0x00,0x07,0xe0,0x0f,0x00,0x00,0xf8,
 0x0f,0x00,0xfe,0x01,0x00,0x0e,0x7e,0x00,0xf8,0x01,0xf8,0x03,0xfc,0x01,0x0e,
 0xe0,0x00,0x00,0xfe,0x00,0x00,0x00,0xfc,0x00,0xfe,0x01,0x03,0xe0,0x0f,0x00,
 0x00,0xfc,0x07,0x00,0xfc,0x01,0x80,0x07,0xfe,0x00,0xf8,0x00,0xf8,0x01,0xfc,
 0x03,0x06,0xe0,0x00,0x00,0x7f,0x00,0x00,0x00,0xfc,0x00,0xfc,0x81,0x03,0xe0,
 0x0f,0x00,0x00,0xff,0x01,0x00,0xfc,0x03,0xc0,0x03,0xfe,0x00,0xf8,0x00,0xf8,
 0x01,0xf8,0x03,0x07,0xe0,0x00,0x00,0x7f,0x00,0x00,0x00,0xfe,0x00,0xfc,0xc3,
 0x01,0xf0,0x0f,0x00,0xe0,0xff,0x00,0x00,0xfc,0x07,0xe0,0x01,0xfe,0x01,0x7c,
 0x00,0xfc,0x01,0xf8,0x87,0x03,0xe0,0x00,0x80,0xff,0x00,0x00,0x00,0xfe,0x00,
 0xf8,0xe7,0x00,0xf0,0x1f,0x00,0xfe,0x3f,0x00,0x00,0xf8,0x0f,0xfc,0x00,0xfc,
 0x03,0x7c,0x00,0xfc,0x01,0xf0,0xcf,0x01,0xe0,0x00,0xe0,0xff,0x03,0x00,0x00,
 0xfe,0x00,0xf8,0xff,0xe0,0xff,0xff,0xff,0xff,0x07,0x00,0x00,0xf0,0xff,0x7f,
 0x00,0xf8,0x0f,0x3e,0x00,0xfc,0x01,0xf0,0xff,0x01,0xe0,0x00,0xff,0xff,0x7f,
 0x00,0x00,0x7e,0x00,0xf0,0x7f,0xe0,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xe0,
 0xff,0x1f,0x00,0xf0,0xff,0x1f,0x00,0xfc,0x00,0xe0,0xff,0x00,0xe0,0x00,0xff,
 0xff,0x7f,0x00,0x00,0x7f,0x00,0xe0,0x3f,0xe0,0xff,0xff,0xff,0x07,0x00,0x00,
 0x00,0xc0,0xff,0x07,0x00,0xe0,0xff,0x07,0x00,0xfe,0x00,0xc0,0x7f,0x00,0xe0,
 0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x80,0x0f,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0xff,0x00,0x00,0x1e,0x00,0x00,0x1f,
 0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0};
}

#
# -----------------------------------------------------------------------------
#
# Proc:    dsk_welcome
# Desc:    Shows an informational "welcome" window when starting up.
# In:      cmd: "show" or "hide"
# Out:     ""
# Side FX: none
#

proc dsk_welcome {cmd} {
    global tkdesk

    #set bgcol gray
    set bgcol gray82
    set t .dsk_welcome

    if {$cmd == "hide"} {
	catch "destroy $t"
	return ""
    }
    
    toplevel $t -bg $bgcol
    wm withdraw $t

    frame $t.f -bd 2 -relief raised -bg $bgcol
    pack $t.f

    frame $t.f1 -bd 2 -relief groove -bg $bgcol
    pack $t.f1 -in $t.f -padx 8 -pady 8

    label $t.lLabel -text "Welcome to..." -anchor center -fg black \
	    -font -*-helvetica-medium-r-*-*-14-* -bg $bgcol
    pack $t.lLabel -in $t.f1 -padx 8 -pady 8 -fill x -expand yes

    image create bitmap welcome_bm -data $tkdesk(welcome_bm) -foreground blue3
    label $t.lTkDesk -image welcome_bm -bg $bgcol
    pack $t.lTkDesk -in $t.f1 -padx 6 -pady 2 -fill x -expand yes

    message $t.lVersion -text "Version $tkdesk(version), dated $tkdesk(date)\nCopyright (C) 1996 Christian Bolik\n\nTkDesk comes with ABSOLUTELY NO WARRANTY,\nsee menu entry Help/License for details." \
	    -font -*-helvetica-medium-r-*-*-14-* -bg $bgcol -fg black \
	    -aspect 1000 -justify center
    pack $t.lVersion -in $t.f1 -padx 8 -pady 8 -fill x -expand yes

    if $tkdesk(in_development) {
	label $t.lDevel -text "...in Development..." \
		-font -*-helvetica-bold-o-*-*-14-* -bg $bgcol -fg black
	pack $t.lDevel -in $t.f1 -padx 8 -pady 8 -fill x -expand yes
    }

    frame $t.f2 -bd 2 -relief groove -bg $bgcol
    pack $t.f2 -in $t.f -fill x -padx 8 -pady 8
    
    label $t.lProgress -text "Loading..." -anchor w \
	    -bg $bgcol -fg black -width 25
    pack $t.lProgress -in $t.f2 -fill x -anchor w -padx 8

    update idletasks
    set x [expr [winfo screenwidth $t]/2 - [winfo reqwidth $t]/2 \
	    - [winfo vrootx [winfo parent $t]]]
    set y [expr [winfo screenheight $t]/2 - [winfo reqheight $t]/2 \
	    - [winfo vrooty [winfo parent $t]]]
    wm geom $t +$x+$y
    wm title $t "Starting..."
    wm deiconify $t
    update

    return ""
}

proc dsk_progress {string} {
    if ![winfo exists .dsk_welcome] return
    
    .dsk_welcome.lProgress config -text $string
    update idletasks
}

proc tkerror {err} {
    global tkdesk errorCode errorInfo tk_patchLevel tcl_patchLevel

    set code $errorCode
    set info $errorInfo
    
    if [winfo exists .dsk_tkerror] return
    
    dsk_lazy "" 1
    dsk_sound dsk_bug
    set ans [tk_dialog [toplevel .dsk_tkerror] \
	    "Oh no, an error!" \
	    "Sorry, but you have just found an error in TkDesk. You can ignore it or choose one of the actions below." \
	    @$tkdesk(library)/images/bomb.xbm \
	    0 " Ignore " " Inspect " " Mail Author "]

    switch $ans {
	1 {dsk_editor string "Error: $err\n\nerrorCode: $code\n\nerrorInfo: $info"}
	2 {
	    set subject "Error in TkDesk $tkdesk(version)"
	    set msg "What did you try to do when this bug occured:\n"
	    append msg "\n\n-----------------------------------------------"
	    append msg "\nError in TkDesk $tkdesk(version), using "
	    append msg "Tcl [set tcl_patchLevel] and "
	    append msg "Tk [set tk_patchLevel].\nPlatform: "
	    catch {append msg "[exec uname -a]\n"}
	    append msg "\n"
	    append msg "Error: $err\n"
	    append msg "errorCode: $code\n"
	    append msg "errorInfo: $info"

	    dsk_mailbug $subject $msg
	}
    }
    
    return ""
}

proc dsk_mailbug {subject msg} {
    global tkdesk dsk_mailbug

    catch {destroy .dsk_mailbug}
    toplevel [set t .dsk_mailbug]
    wm withdraw $t

    frame $t.f1 -bd 1 -relief raised
    pack $t.f1 -fill x
    label $t.ls -text "Subject:"
    pack $t.ls -in $t.f1 -side left -padx 4 -pady 4
    entry $t.es -width 10 -bd 2 -relief sunken
    $t.es insert end $subject
    pack $t.es -in $t.f1 -side left -fill x -expand yes \
	    -padx 4 -pady 4 -ipady 2

    frame $t.f2 -bd 1 -relief raised
    pack $t.f2 -fill both -expand yes
    frame $t.f2a
    pack $t.f2a -in $t.f2 -fill both -expand yes -padx 4 -pady 4
    text $t.tm -width 10 -height 4 -bd 2 -relief sunken -setgrid 1 \
	    -yscroll "$t.sb set"
    $t.tm insert end "$msg"
    $t.tm mark set insert 2.0
    pack $t.tm -in $t.f2a -side left -fill both -expand yes
    scrollbar $t.sb -orient vertical -command "$t.tm yview"
    pack $t.sb -in $t.f2a -side left -fill y

    frame $t.f3 -bd 1 -relief raised
    pack $t.f3 -fill x
    button $t.bc -text "Cancel" \
	    -command "set dsk_mailbug(mail) 0"
    button $t.bm -text "Send Mail to $tkdesk(authormail)" \
	    -command "set dsk_mailbug(mail) 1"
    pack $t.bc $t.bm -in $t.f3 -side left -padx 4 -pady 4 -ipady 1

    wm protocol $t WM_DELETE_WINDOW "set dsk_mailbug(mail) 0"
    wm title $t "Mail Bug Report to Author"
    wm geometry $t 38x15
    cb_centerToplevel $t
    wm deiconify $t

    focus $t.tm
    grab $t
    set dsk_mailbug(mail) ""
    tkwait variable dsk_mailbug(mail)

    if $dsk_mailbug(mail) {
	catch {set fd [open "|mail -s \"$subject\" $tkdesk(authormail)" w]} em
	if ![info exists fd] {
	    catch {set fd [open "|mail $tkdesk(authormail)" w]} em
	}
	if ![info exists fd] {
	    cb_error "Couldn't execute: mail $tkdesk(authormail). Please send your bug report manually."
	    tkwait variable dsk_mailbug(mail)
	} else {
	    set msg [$t.tm get 1.0 end]
	    puts -nonewline $fd $msg
	    close $fd
	}
    }
    destroy $t
}

#
# -----------------------------------------------------------------------------
#

dsk_welcome show

if ![info exists tkdesk(library)] {
    set tkdesk(library) "./tcldesk"
}
if {$tkdesk(library) == "./tcldesk"} {
    # need an absolute library path
    set tkdesk(library) [pwd]/tcldesk
}

# "Uglify" ;-) namespaced BLT:
if {[info command bgexec] != ""} {
    rename bgexec blt_bgexec
}
if {[info command busy] != ""} {
    rename busy blt_busy
}
if {[info command drag&drop] != ""} {
    # this must be handled differently due to internal bindings:
    proc blt_drag&drop {args} {
	eval drag&drop $args
    }
}


#
# Init cb_tools
#

dsk_progress "Initializing cb_tools..."
set cb_tools(path) "$tkdesk(library)/cb_tools"
source $cb_tools(path)/tools.tcl
cb_tools_init $cb_tools(path) 1

#cb_debug trace wm
#cb_debug trace update
#cb_debug trace cb_image

#
# Init tcldesk
#

if {[info command grab-orig] == ""} {
    rename grab grab-orig
    proc grab {args} {
	set ret ""
	catch {set ret [eval grab-orig $args]}
	return $ret
    }
}

if {[info command itcl_class-orig] == ""} {
    rename itcl_class itcl_class-orig
    proc itcl_class {name def} {
	catch {rename $name {}}
	uplevel 1 itcl_class-orig $name [list $def]
    }
}

# Give options set in tk_setPalette higher priority (to override weird
# CDE resources, for instance):
catch {tk_setPalette}
if [regsub {widgetDefault} [info body tk_setPalette] {interactive} nb] {
    proc tk_setPalette [info args tk_setPalette] $nb
    unset nb
}

dsk_progress "Initializing tcldesk..."
foreach c [itcl_info classes dsk_*] {
    catch {rename $c {}}
}
# use lsort to have a defined sequence of files sourced:
foreach f [lsort [glob $tkdesk(library)/*.tcl]] {
    #puts $f
    source $f
}
    
if $tkdesk(in_development) {
    blt_drag&drop errors tkerror
} else {
    blt_drag&drop errors ""
}

#
# ====  Set misc. global variables ============================================
#

set tkdesk(authormail) "Christian.Bolik@Mainz.netsurf.de"
set tkdesk(startdir) [pwd]
set tkdesk(initdir) $tkdesk(startdir)
set tkdesk(menu,control) 0	;# used to track <control> in menu invocations
set tkdesk(file_lb,control) 0	;# used to track <control> in file LBs
set tkdesk(active_viewer) ""	;# contains name of window in which last
				 # action was invoked
set tkdesk(button_bar) ""	;# list for the button bar
set tkdesk(xmaster) 0		;# X "master" app
set tkdesk(status) lazy         ;# busy or lazy
set tkdesk(_dd_x) 0
set tkdesk(_dd_y) 0
set tkdesk_filelb_cmd ""
set tkdesk(systype) ""
catch {set tkdesk(systype) [exec uname]}

set tkPriv(x) 0
set tkPriv(y) 0

# see if the current window manager is fvwm (if this is the
# case a special hack is required for repositioning windows):
set err [catch {
    set tkdesk(fvwm) [regexp fvwm [exec ps]]
}]
if $err {
    set tkdesk(fvwm) 0
}

# Overwrite cb_tools' busy and lazy commands:
set cb_tools(busy_cmd) dsk_busy
set cb_tools(lazy_cmd) dsk_lazy

# cd to user's home dir cause this is unlikely to be moved/deleted
cd $env(HOME)

#
# ==== Process command line arguments =========================================
#

dsk_busy
dsk_progress "Processing command line options..."
dsk_debug "Processing cmdline arguments"
set tkdesk(iconic) 0
if {$argc > 0} {
    for {set i 0} {$i < [llength $argv]} {incr i} {
	set o [lindex $argv $i]
	switch -glob -- $o {
	    -conf* {
		incr i
		set tkdesk(configdir) [lindex $argv $i]
		if {[string index $tkdesk(configdir) 0] != "/" && \
		    [string index $tkdesk(configdir) 0] != "~"} {
		    set tkdesk(configdir) $tkdesk(startdir)/$tkdesk(configdir)
		}
	    }
	    -deb* {
		set tkdesk(debug) 1
		dsk_debug "Debugging enabled (hopefully :-))"
	    }
	    -def* {
		set tkdesk(configdir) $tkdesk(library)/configs
		dsk_debug "Reading default configuration."
	    }
	    -fvwm {
		set tkdesk(fvwm) 1
		dsk_debug "Fvwm mode forced."
	    }
	    -ic* {
		set tkdesk(iconic) 1
		dsk_debug "Iconic startup."
	    }
	    -sta* {
		incr i
		set tkdesk(user,startdir) [lindex $argv $i]
	    }
	    -xm* {
		set tkdesk(xmaster) 1
	    }
	    default {
		if {[string index $o 0] == "-"} {
		    puts "Don't know what $o means. Proceding anyway."
		} else {
		    set tkdesk(initdir) $o
		    dsk_debug " tkdesk(initdir) = $tkdesk(initdir)"
		}
	    }
	}
    }
}

#
# ==== Read config files: =====================================================
#

dsk_progress "Reading configuration..."
dsk_read_config

if {[winfo depth .] == 1} {
    set tkdesk(append_type_char) 1
    dsk_FileListbox :: typechar $tkdesk(append_type_char)
}

#
# ==== Start-up ===============================================================
#

dsk_debug "Now starting up"
if ![info exists tkdesk(restarted)] {
    dsk_sound dsk_welcome_begin
}

#
# ---- Enable path and command history:
#
dsk_progress "Enabling history..."
dsk_history history -size $tkdesk(history_size)
dsk_history cmd_history -size $tkdesk(history_size) \
	-callback dsk_ask_exec_cb
dsk_history pcmd_history -size $tkdesk(history_size) \
	-callback dsk_periodic_cb
dsk_history hsearch_history -size $tkdesk(history_size) \
	-callback dsk_editor_hsearch_cb
dsk_history file_history -size $tkdesk(history_size) \
	-command "dsk_open .fv0"
dsk_history exec_history -size $tkdesk(history_size) \
	-command "dsk_exec"

set histlist {history cmd_history pcmd_history hsearch_history \
	file_history exec_history}
set hi 0

if [info exists tkdesk(history_list)] {
    set hlist [lindex $histlist 0]
    foreach h $tkdesk(history_list) {
	if {[string index [lindex $h 0] 0] != "#"} {
	    $hlist add $h
	} else {
	    incr hi
	    set hlist [lindex $histlist $hi]
	}
    }
}

unset histlist hi

#
# ---- Possibly restore the window layout of the last session:
#
dsk_progress "Restoring layout..."
dsk_restore_layout

#
# ---- Open the initial file viewer window:
#

if {![info exists tkdesk(layout)] || !$tkdesk(have_window)} {
    # disable at_pointer placement for initial window:
    set ap $tkdesk(at_pointer)
    set tkdesk(at_pointer) 0
    
    dsk_progress "Creating a file browser..."
    set dir [history get]
    if {$dir != ""} {
	set dir [lindex $dir end]
    } else {
	if [info exists tkdesk(user,startdir)] {
	    set dir $tkdesk(user,startdir)
	} else {
	    set dir $tkdesk(initdir)
	}
    }
    set tkdesk(geometry,fbrowser) \
	    $tkdesk(file_lb,width)x$tkdesk(file_lb,height)+100+50
    dsk_FileViewer .fv[dsk_FileViewer :: id] \
	    -dir $dir -num_lbs $tkdesk(num_lbs)
    set tkdesk(geometry,fbrowser) ""

    # create the Trash window:
    #set twin .dfl[dsk_FileList :: id]
    #dsk_progress "Creating the trash window..."
    #dsk_FileList $twin -dir $tkdesk(configdir)/.trash -dontmap 1
    #update
    #wm iconify $twin
    #unset twin

    # and the app bar
    dsk_progress "Creating the Application Bar..."
    dsk_appbar

    set tkdesk(at_pointer) $ap
}

if ![info exists tkdesk(restarted)] {
    #
    # ---- Start the periodic update of the file listboxes:
    #
    dsk_progress "Starting background procs..."
    after [expr $tkdesk(update,file_lists) * 1000] dsk_update_flbs

    # ... and the periodic config-save:
    if !$tkdesk(xmaster) {
	after [expr $tkdesk(update,config) * 60000] dsk_persave_config
    }
}

dsk_progress "Ready."
if ![info exists tkdesk(restarted)] {
    dsk_sound dsk_welcome_end
}
dsk_welcome hide
dsk_lazy

if [info exists tkdesk(first_time_user)] {
    dsk_help quick
}

#
# ==== Misc. Procs ============================================================
#

#
# -----------------------------------------------------------------------------
#
# Proc:		dsk_exit
# Args:		ask	(opt.) set to 1 if it should ask by all means
# Returns: 	""
# Desc:		Exits TkDesk.
# Side-FX:	May lead to the termination of tkdesk.
#

proc dsk_exit {{ask 0}} {
    global tkdesk

    if {($tkdesk(ask_on_exit) && !$tkdesk(in_development)) || $ask} {
	if !$tkdesk(xmaster) {
	    set msg "Are you sure you want to exit TkDesk?"
	} else {
	    set msg "This will end your X Session! Is this o.k.?"
	}
    	if {[cb_yesno $msg] != 0} {
	    return
	}
    }

    foreach obj [itcl_info objects -class dsk_Editor] {
	if {[$obj close_win] == "cancel"} {
	    return
	}
    }
    dsk_save_config
    dsk_sound dsk_quit_tkdesk
    exit 0
}

#
# -----------------------------------------------------------------------------
#
# Proc:		dsk_restart
# Args:		-
# Returns: 	""
# Desc:		Restarts TkDesk.
# Side-FX:	none
#

proc dsk_restart {} {
   global argv0 tkdesk

    dsk_save_config

    # clean up
    cb_image !reset
    foreach obj [itcl_info objects -class dsk_Editor] {
	if {[$obj close_win] == "cancel"} {
	    return
	}
    }
    catch {eval itcl_unload [itcl_info classes]}
    foreach w [winfo children .] {destroy $w}

    # and now restart
    set tkdesk(restarted) 1
    uplevel #0 "cd $tkdesk(startdir)"
    uplevel #0 "source $argv0"
}

