head	1.20;
access;
symbols
	rel-7-10-4:1.11
	STABLE:1.11.0.2
	rel-7-10-2:1.11
	rel-7-10-0:1.11
	rel-7-8-4:1.8
	rel-7-8-2:1.6
	rel-7-8-0:1.6
	trimnurbs-branch:1.6.0.2
	help:1.6
	temp_tag:1.2
	bobWinPort-20051223-freeze:1.1.2.8
	postmerge-20051223-bobWinPort:1.2
	bobWinPort:1.1.0.2;
locks; strict;
comment	@# @;


1.20
date	2007.12.14.21.35.57;	author bob1961;	state Exp;
branches;
next	1.19;

1.19
date	2007.12.13.21.10.00;	author bob1961;	state Exp;
branches;
next	1.18;

1.18
date	2007.11.29.21.37.38;	author bob1961;	state Exp;
branches;
next	1.17;

1.17
date	2007.11.09.21.32.37;	author bob1961;	state Exp;
branches;
next	1.16;

1.16
date	2007.10.02.06.35.07;	author brlcad;	state Exp;
branches;
next	1.15;

1.15
date	2007.10.02.00.41.20;	author brlcad;	state Exp;
branches;
next	1.14;

1.14
date	2007.10.01.06.50.09;	author brlcad;	state Exp;
branches;
next	1.13;

1.13
date	2007.10.01.05.34.04;	author brlcad;	state Exp;
branches;
next	1.12;

1.12
date	2007.09.14.15.21.02;	author erikgreenwald;	state Exp;
branches;
next	1.11;

1.11
date	2007.02.20.08.58.00;	author brlcad;	state Exp;
branches;
next	1.10;

1.10
date	2007.01.23.01.13.23;	author brlcad;	state Exp;
branches;
next	1.9;

1.9
date	2007.01.20.14.36.42;	author brlcad;	state Exp;
branches;
next	1.8;

1.8
date	2006.09.18.09.43.00;	author brlcad;	state Exp;
branches;
next	1.7;

1.7
date	2006.08.22.19.41.39;	author bob1961;	state Exp;
branches;
next	1.6;

1.6
date	2006.01.31.00.50.51;	author brlcad;	state Exp;
branches;
next	1.5;

1.5
date	2006.01.19.02.08.07;	author brlcad;	state Exp;
branches;
next	1.4;

1.4
date	2006.01.05.16.48.20;	author bob1961;	state Exp;
branches;
next	1.3;

1.3
date	2005.12.29.03.52.52;	author brlcad;	state Exp;
branches;
next	1.2;

1.2
date	2005.12.23.21.26.29;	author bob1961;	state Exp;
branches;
next	1.1;

1.1
date	2005.09.14.13.14.53;	author bob1961;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2005.09.14.13.14.53;	author bob1961;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2005.09.15.16.24.15;	author bob1961;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2005.09.21.14.01.14;	author bob1961;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2005.09.22.02.41.08;	author bob1961;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2005.09.22.03.39.26;	author bob1961;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2005.09.22.12.37.07;	author bob1961;	state Exp;
branches;
next	1.1.2.7;

1.1.2.7
date	2005.09.28.16.09.49;	author bob1961;	state Exp;
branches;
next	1.1.2.8;

1.1.2.8
date	2005.10.06.20.47.44;	author bob1961;	state Exp;
branches;
next	;


desc
@@


1.20
log
@Mods related to class variables moving from Archer to ArcherCore.
@
text
@#!/bin/sh
#                         A R C H E R
# BRL-CAD
#
# Copyright (c) 2002-2007 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# version 2.1 as published by the Free Software Foundation.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this file; see the file named COPYING for more
# information.
#
###
#
# Archer
#
# Author(s):
#    Bob Parker
#    Doug Howard
#
# Description:
#    Main for Archer.
#
#\
ARCHER_HOME=`dirname $0`/..
#\
export ARCHER_HOME
# restart using bwish \
WISH="bwish"
#\
for ish in bwish bwish_d ; do
# see if we're installed \
    if test -f ${ARCHER_HOME}/bin/$ish ; then
#\
	WISH="${ARCHER_HOME}/bin/$ish"
#\
	break;
#\
    fi
# see if we're not installed yet \
    if test -f ${ARCHER_HOME}/bwish/$ish ; then
#\
	WISH="${ARCHER_HOME}/bwish/$ish"
#\
	break;
#\
    fi
#\
done
#\
exec $WISH $0 $@@

# normalize ARCHER_HOME
if {[info exists env(ARCHER_HOME)]} {
    set dir [file normalize $env(ARCHER_HOME)]
} else {
    set dir [file normalize [file join [file dir $argv0] ..]]
}
set env(ARCHER_HOME) $dir

# Decide on a parent class for Archer
#namespace eval Archer {
#    if {1} {
#	set parentClass itk::Toplevel
#	set inheritFromToplevel 1
#    } else {
#	set parentClass TabWindow
#	set inheritFromToplevel 0
#    }
#}

# stupid blt needs blt_library to be set (must be done AFTER loading BLT...)
set blt_library [file normalize [file join [bu_brlcad_root "lib"] blt2.4]]
if {![file exists $blt_library]} {
    set blt_library [file normalize [file join [bu_brlcad_data "src"] other blt library]]
}
if {![file exists $blt_library]} {
    puts "ERROR: Unable to initialize Archer resources"
    exit 1
}

# load archer guts
if { [catch {package require Archer 1.0} _initialized] } {
    puts "$_initialized"
    puts ""
    puts "ERROR: Unable to load Archer"
    exit 1
}

set Archer::debug 0
if { [info exists env(DEBUG)] } {
    puts "Using ARCHER_HOME of $env(ARCHER_HOME)"
    set Archer::debug $env(DEBUG)
}

# Initialize bgerror
initBgerror


# PROCEDURE: showMainWindow
#
# Show the main window.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc showMainWindow {} {
    if {$::ArcherCore::inheritFromToplevel} {
	wm deiconify $::ArcherCore::application
	raise $::ArcherCore::application
	focus -force $::ArcherCore::application
    } else {
	wm deiconify .
	raise .
	focus -force .
    }
}

# PROCEDURE: createSplashScreen
#
# Create the proper splash screen based on gui mode.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc createSplashScreen {} {
    global env

    # XXX disabled until tkimg is working better
    set useImage 1

    if {$useImage} {
	set image [image create photo -file [file join [bu_brlcad_data "tclscripts"] archer images aboutArcher.png]]
	set ::ArcherCore::splash [Splash .splash -image $image]
    } else {
	set ::ArcherCore::splash [Splash .splash -message "Loading Archer ... please wait ..."]
    }

    update idletasks
    $::ArcherCore::splash configure -background $::ArcherCore::SystemWindow
    $::ArcherCore::splash center
    update idletasks
    $::ArcherCore::splash activate
    after 3000 destroySplashScreen; # 3 more sec
    update
}

# PROCEDURE: destroySplashScreen
#
# Makes sure the gui is ready to go and then
# destroys the splash screen.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc destroySplashScreen {} {
    # check to see if main gui is ready
    if {$::ArcherCore::showWindow == 0} {
        after 1000 destroySplashScreen; # 1 more sec
        return
    }

    if {$::ArcherCore::splash == ""} {
	return
    }
    $::ArcherCore::splash deactivate
    itcl::delete object $::ArcherCore::splash
    set ::ArcherCore::splash ""
    showMainWindow
}

proc exitArcher {archer} {
    $archer askToSave

    if {$::ArcherCore::inheritFromToplevel} {
	wm withdraw $archer
    } else {
	wm withdraw .
    }

    if {$archer != ""} {
	::itcl::delete object $archer
    }

    exit
}

# *************** Main Function ***************

# PROCEDURE: main
#
# Main procedure for AJEM/MUVES GUI.  Sets up and handles initialization.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc main {} {
    global env
    global tcl_platform
    global argv

    if {$::ArcherCore::inheritFromToplevel} {
	set ::ArcherCore::application [Archer .\#auto]
	wm title $::ArcherCore::application "Archer"
	if {$tcl_platform(os) == "Windows NT"} {
	    wm iconbitmap $::ArcherCore::application -default \
		[file join [bu_brlcad_data "html"] manuals archer archer.ico]
	}
	set size [wm maxsize $::ArcherCore::application]
        set width [expr {[lindex $size 0] - 8}]
        set height [expr {[lindex $size 1] - 40}]
	wm geometry $::ArcherCore::application "$width\x$height+0+0"
	wm protocol $::ArcherCore::application WM_DELETE_WINDOW {exitArcher $::ArcherCore::application}
    } else {
	wm title . "Archer"
	if {$tcl_platform(os) == "Windows NT"} {
	    wm iconbitmap . -default \
		[file join [bu_brlcad_data "doc"] html manuals archer archer.ico]
	}
	set ::ArcherCore::application [Archer .\#auto]
	set size [wm maxsize .]
        set width [expr {[lindex $size 0] - 8}]
        set height [expr {[lindex $size 1] - 40}]
	pack $::ArcherCore::application -expand yes -fill both
	wm geometry . "$width\x$height+0+0"
	wm protocol . WM_DELETE_WINDOW [list exitArcher $::ArcherCore::application]
    }

    if {$argv != ""} {
	set target [lindex $argv 0]
	set ext [file extension $target]
	if {$ext == ".g"} {
	    $::ArcherCore::application Load "BRL-CAD" $target
	} elseif {$ext == ".xg" || $ext == ".sdb"} {
	    $::ArcherCore::application Load "IVAVIEW" $target
	}
    }

    $::ArcherCore::application configure -quitcmd [list exitArcher $::ArcherCore::application]

    update
}

# TCL script execution start HERE!
wm withdraw .

# start splash screen
createSplashScreen

# do main procedure
if { [catch {main} _runnable] } {
	puts "$_runnable"
	puts ""
	puts "Unexpected error encountered while running Archer."
	puts "Aborting."
	exit 1
}
set ::ArcherCore::showWindow 1

# Local Variables:
# mode: sh
# tab-width: 8
# sh-indentation: 4
# sh-basic-offset: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8
@


1.19
log
@Mods related to using ArcherCore
@
text
@d120 3
a122 3
	wm deiconify $::Archer::archer
	raise $::Archer::archer
	focus -force $::Archer::archer
d148 1
a148 1
	set ::Archer::splash [Splash .splash -image $image]
d150 1
a150 1
	set ::Archer::splash [Splash .splash -message "Loading Archer ... please wait ..."]
d154 2
a155 2
    $::Archer::splash configure -background $::ArcherCore::SystemWindow
    $::Archer::splash center
d157 1
a157 1
    $::Archer::splash activate
d175 1
a175 1
    if {$::Archer::showWindow == 0} {
d180 1
a180 1
    if {$::Archer::splash == ""} {
d183 3
a185 3
    $::Archer::splash deactivate
    itcl::delete object $::Archer::splash
    set ::Archer::splash ""
d223 2
a224 2
	set ::Archer::archer [Archer .\#auto]
	wm title $::Archer::archer "Archer"
d226 1
a226 1
	    wm iconbitmap $::Archer::archer -default \
d229 1
a229 1
	set size [wm maxsize $::Archer::archer]
d232 2
a233 2
	wm geometry $::Archer::archer "$width\x$height+0+0"
	wm protocol $::Archer::archer WM_DELETE_WINDOW {exitArcher $::Archer::archer}
d240 1
a240 1
	set ::Archer::archer [Archer .\#auto]
d244 1
a244 1
	pack $::Archer::archer -expand yes -fill both
d246 1
a246 1
	wm protocol . WM_DELETE_WINDOW [list exitArcher $::Archer::archer]
d253 1
a253 1
	    $::Archer::archer Load "BRL-CAD" $target
d255 1
a255 1
	    $::Archer::archer Load "IVAVIEW" $target
d259 1
a259 1
    $::Archer::archer configure -quitcmd [list exitArcher $::Archer::archer]
d278 1
a278 1
set ::Archer::showWindow 1
@


1.18
log
@html is no longer under doc on Windows.
@
text
@d70 9
a78 9
namespace eval Archer {
    if {1} {
	set parentClass itk::Toplevel
	set inheritFromToplevel 1
    } else {
	set parentClass TabWindow
	set inheritFromToplevel 0
    }
}
d119 1
a119 1
    if {$::Archer::inheritFromToplevel} {
d154 1
a154 1
    $::Archer::splash configure -background $::Archer::SystemWindow
d192 1
a192 1
    if {$::Archer::inheritFromToplevel} {
d222 1
a222 1
    if {$::Archer::inheritFromToplevel} {
@


1.17
log
@Archer now depends on bwish.
@
text
@d227 1
a227 1
		[file join [bu_brlcad_data "doc"] html manuals archer archer.ico]
@


1.16
log
@the mighty bob lieth not.  blt_library really _does_ need to be set AFTER blt is loaded.  the variable is wiped out during Blt_Init() yet is subsequently required/expected in the Tabnotebook.  this is the final mod that actually makes Archer work on Mac OS X (tested, and seemingly fully functional) and probably on Linux and BSD too now.
@
text
@d37 1
a37 1
WISH="wish"
d39 1
a39 1
for ish in bwish bwish_d wish wish_d ; do
a79 14
# preload tk
if { [ catch {package require Tk} _initialized ] } {
    puts ""
    puts "ERROR: Unable to initialize Archer"
    exit 1
}
# preload blt
if { [ catch {package require BLT} _initialized ] } {
    puts "$_initialized"
    puts ""
    puts "ERROR: Unable to initialize Archer GUI"
    exit 1
}

a97 13
if { [catch {package require Iwidgets} _initialized] } {
    puts "$_initialized"
    puts ""
    puts "ERROR: Unable to load Archer GUI"
    exit 1
}
if { [catch {package require Swidgets} _initialized] } {
    puts "$_initialized"
    puts ""
    puts "ERROR: Unable to load Archer Scripting"
    exit 1
}

@


1.15
log
@additional try/catch checking for archer so that we can print better abort messages when things go horribly wrong
@
text
@d94 10
@


1.14
log
@tkimg works if you load the .so
@
text
@d61 1
a61 2
# Set the auto_path in order to constrain
# where Archer finds its files.
d80 1
d86 1
d94 20
a113 3
package require Archer 1.0
package require Iwidgets
package require Swidgets
d288 7
a294 1
main
@


1.13
log
@variety of minor restructuring. use bu_brlcad_data more intelligently/consistently relying on it also working with uninstalled builds.  disable the splash logo since tkimg isn't integrated correctly yet (still also have a problem with blt too).  get rid of the massive auto_path hack since that's handled by libtclcad/bwish much more aggressively.
@
text
@d143 1
a143 1
    set useImage 0
@


1.12
log
@removed trailing whitespace
@
text
@a58 2
echo $WISH $0 $@@
#\
a60 2
#auto_mkindex_parser::slavehook { _%@@namespace import -force ::itcl::* }

a67 1

a69 37
if {$tcl_platform(os) == "Windows NT"} {
    set brlcadDataPath $env(ARCHER_HOME)
} else {
    set brlcadDataPath [bu_brlcad_data ""]
}

lappend auto_path $dir
lappend auto_path [file join $env(ARCHER_HOME) lib]
lappend auto_path [file join $env(ARCHER_HOME) lib tcl8.5]
lappend auto_path [file join $env(ARCHER_HOME) lib tk8.5]
lappend auto_path [file join $env(ARCHER_HOME) lib tcl8.4]
lappend auto_path [file join $env(ARCHER_HOME) lib tk8.4]
lappend auto_path [file join $env(ARCHER_HOME) lib itcl3.3]
lappend auto_path [file join $env(ARCHER_HOME) lib itk3.3]
lappend auto_path [file join $env(ARCHER_HOME) lib iwidgets4.0.2]
lappend auto_path [file join $env(ARCHER_HOME) lib iwidgets4.0.2 scripts]
lappend auto_path [file join $env(ARCHER_HOME) lib blt2.4]
lappend auto_path [file join $env(ARCHER_HOME) lib blt2.4 dd_protocols]
lappend auto_path [file join $env(ARCHER_HOME) lib sdb]
lappend auto_path [file join $brlcadDataPath tclscripts]
lappend auto_path [file join $brlcadDataPath tclscripts sdialogs]
lappend auto_path [file join $brlcadDataPath tclscripts sdialogs scripts]
lappend auto_path [file join $brlcadDataPath tclscripts swidgets]
lappend auto_path [file join $brlcadDataPath tclscripts swidgets scripts]
lappend auto_path [file join $brlcadDataPath tclscripts lib]
lappend auto_path [file join $brlcadDataPath tclscripts archer]
lappend auto_path [file join $dir tclscripts]
lappend auto_path [file join $dir tclscripts sdialogs]
lappend auto_path [file join $dir tclscripts sdialogs scripts]
lappend auto_path [file join $dir tclscripts swidgets]
lappend auto_path [file join $dir tclscripts swidgets scripts]
lappend auto_path [file join $dir tclscripts lib]
lappend auto_path [file join $dir tclscripts archer]

# Initialize bgerror
initBgerror

d81 12
a92 1
set Archer::debug 0
d97 9
a105 3
# This must be done after loading BLT (that potentially gets it wrong)
set blt_library [file join $env(ARCHER_HOME) lib blt2.4]
lappend auto_path $blt_library
a140 1
    global brlcadDataPath
d142 2
a143 1
    set useImage 1
d146 1
a146 1
	set image [image create photo -file [file join $brlcadDataPath tclscripts archer images aboutArcher.png]]
d149 1
a149 1
	set ::Archer::splash [Splash .splash -message "Loading Archer..."]
a217 1
    global brlcadDataPath
d226 1
a226 1
		[file join $brlcadDataPath doc html manuals archer archer.ico]
d237 1
a237 1
		[file join $brlcadDataPath doc html manuals archer archer.ico]
@


1.11
log
@search for tcl/tk 8.5 too (we're upgrading to it now)
@
text
@d294 1
a294 1
 
@


1.10
log
@Sweeping license updates.  Documentation is fully relicensed to the BSD Documentation License (a minor variant of the FreeBSD Documentation License and BSD License).  All GPL code (mostly application code) is converted to the LGPL and now also specifically declares version 2.1, revoking the blank check to the FSF.  The intent of these sweeping changes are to simplify the licensing terms and increase overall flexibility of use, both externally (to users for their purposes) and internally (to allow application code to be migrated to libraries without creating GPL libraries).  As a collective work, BRL-CAD is now LGPL.
@
text
@d83 2
@


1.9
log
@update copyright to 2007
@
text
@d10 1
a10 2
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
@


1.8
log
@file name is just archer, not archer.sh
@
text
@d5 1
a5 1
# Copyright (c) 2002-2006 United States Government as represented by
@


1.7
log
@Added code to handle an argument.
@
text
@d2 1
a2 1
#                       A R C H E R . S H
@


1.6
log
@to quote Bob's commit to src/archer/archer "All of archer including the tclscripts is assigned to u.s. government and should be under the LGPL" so add the boilerplate legal header and remove the survice claim.  the COPYING file requires this as well.  also add the boilerplate variables footer while we're at it.
@
text
@d244 1
d273 10
@


1.5
log
@have archer search the current directory for tclscripts in case we're not installed
@
text
@d23 10
a63 16
##
# Portions Copyright (c) 2002 SURVICE Engineering Company. All Rights Reserved.
# This file contains Original Code and/or Modifications of Original Code as
# defined in and that are subject to the SURVICE Public Source License
# (Version 1.3, dated March 12, 2002).
#
# Archer
#
# Author(s):
#    Bob Parker
#    Doug Howard
#
# Description:
#    Main for Archer.
#

d286 9
@


1.4
log
@All of archer including the tclscripts is assigned to u.s. government and should be under the LGPL
@
text
@d88 1
a88 2

set auto_path $dir
d106 7
@


1.3
log
@add support to archer for running without necesssarily being installed yet
@
text
@d2 21
@


1.2
log
@Merge of bobWinPort
@
text
@d7 25
a31 2
exec ${ARCHER_HOME}/bin/bwish $0 $@@
#exec ${ARCHER_HOME}/bin/bwish_d $0 $@@
@


1.1
log
@file archer was initially added on branch bobWinPort.
@
text
@d1 241
@


1.1.2.1
log
@Initial check-in
@
text
@a0 271
#!/bin/sh
#\
ARCHER_HOME=`dirname $0`/..
#\
export ARCHER_HOME
# restart using wish \
exec ${ARCHER_HOME}/bin/wish $0 $@@
#exec ${ARCHER_HOME}/bin/wish_d $0 $@@

##
# Portions Copyright (c) 2002 SURVICE Engineering Company. All Rights Reserved.
# This file contains Original Code and/or Modifications of Original Code as
# defined in and that are subject to the SURVICE Public Source License
# (Version 1.3, dated March 12, 2002).
#
# Archer
#
# Author(s):
#    Bob Parker
#    Doug Howard
#
# Description:
#    Main for Archer.
#

#auto_mkindex_parser::slavehook { _%@@namespace import -force ::itcl::* }

# Set the auto_path in order to constrain
# where Archer finds its files.
if {[info exists env(ARCHER_HOME)]} {
    set dir [file normalize $env(ARCHER_HOME)]
} else {
    set dir [file normalize [file join [file dir $argv0] ..]]
}

set env(ARCHER_HOME) $dir

set auto_path $dir
lappend auto_path [file join $dir lib]
lappend auto_path [file join $dir lib tcl8.4]
lappend auto_path [file join $dir lib tk8.4]
lappend auto_path [file join $dir lib itcl3.3]
lappend auto_path [file join $dir lib itk3.3]
lappend auto_path [file join $dir lib iwidgets4.0.2]
lappend auto_path [file join $dir lib iwidgets4.0.2 scripts]
lappend auto_path [file join $dir lib sdialogs]
lappend auto_path [file join $dir lib sdialogs scripts]
lappend auto_path [file join $dir lib swidgets]
lappend auto_path [file join $dir lib swidgets scripts]
lappend auto_path [file join $dir lib sdb]
lappend auto_path [file join $dir tclscripts]
lappend auto_path [file join $dir tclscripts lib]
lappend auto_path [file join $dir tclscripts archer]

# Initialize bgerror
initBgerror

set archerDebug 0
package require Archer 1.0
package require Iwidgets
package require Swidgets

# This must be done after loading BLT (that potentially gets it wrong)
set blt_library [file join $dir lib blt2.4z]
lappend auto_path $blt_library

# Decide on a parent class for Archer
namespace eval Archer {
    if {1} {
	set parentClass itk::Toplevel
	set inheritFromToplevel 1
    } else {
	set parentClass TabWindow
	set inheritFromToplevel 0
    }
}

# PROCEDURE: SetWaitCursor
#
# Changes the cursor for all of the GUI's widgets to the wait cursor.
#
# Arguments:
#       None
#
# Results:
#       None
#
proc SetWaitCursor {} {
    update
    set children [winfo children .]
    foreach kid $children {
        if {![catch {$kid isa "::itk::Toplevel"} result]} {
            switch -- $result {
                "1" {catch {blt::busy $kid}}
            }
        }
    }
    blt::busy .
    update
}

# PROCEDURE: SetNormalCursor
#
# Changes the cursor for all of the GUI's widgets to the normal cursor.
#
# Arguments:
#       None
#
# Results:
#       None
#
proc SetNormalCursor {} {
    update
    set children [winfo children .]
    foreach kid $children {
        if {![catch {$kid isa "::itk::Toplevel"} result]} {
            switch -- $result {
                "1" {catch {blt::busy release $kid}}
            }
        }
    }
    blt::busy release .
    update
}

# PROCEDURE: showMainWindow
#
# Show the main window.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc showMainWindow {} {
    if {$::Archer::inheritFromToplevel} {
	wm deiconify $::Archer::archer
	raise $::Archer::archer
	focus -force $::Archer::archer
    } else {
	wm deiconify .
	raise .
	focus -force .
    }
}

# PROCEDURE: createSplashScreen
#
# Create the proper splash screen based on gui mode.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc createSplashScreen {} {
    global env

    set useImage 1

    if {$useImage} {
	set image [image create photo -file [file join $env(ARCHER_HOME) tclscripts archer images aboutArcher.png]]
	set ::Archer::splash [Splash .splash -image $image]
    } else {
	set ::Archer::splash [Splash .splash -message "Loading Archer..."]
    }

    update idletasks
    $::Archer::splash configure -background SystemWindow
    $::Archer::splash center
    update idletasks
    $::Archer::splash activate
    after 3000 destroySplashScreen; # 3 more sec
    update
}

# PROCEDURE: destroySplashScreen
#
# Makes sure the gui is ready to go and then
# destroys the splash screen.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc destroySplashScreen {} {
    # check to see if main gui is ready
    if {$::Archer::showWindow == 0} {
        after 1000 destroySplashScreen; # 1 more sec
        return
    }

    if {$::Archer::splash == ""} {
	return
    }
    $::Archer::splash deactivate
    itcl::delete object $::Archer::splash
    set ::Archer::splash ""
    showMainWindow
}

proc exitArcher {archer} {
    $archer askToSave

    if {$::Archer::inheritFromToplevel} {
	wm withdraw $archer
    } else {
	wm withdraw .
    }

    if {$archer != ""} {
	::itcl::delete object $archer
    }

    exit
}

# *************** Main Function ***************

# PROCEDURE: main
#
# Main procedure for AJEM/MUVES GUI.  Sets up and handles initialization.
#
# Arguments:
#       None
#
# Results:
#       No return.
#
proc main {} {
    global env

    if {$::Archer::inheritFromToplevel} {
	set ::Archer::archer [Archer .\#auto]
	wm title $::Archer::archer "Archer"
	wm iconbitmap $::Archer::archer -default [file join $env(ARCHER_HOME) archer.ico]
	set size [wm maxsize $::Archer::archer]
        set width [expr {[lindex $size 0] - 8}]
        set height [expr {[lindex $size 1] - 40}]
	wm geometry $::Archer::archer "$width\x$height+0+0"
	wm protocol $::Archer::archer WM_DELETE_WINDOW {exitArcher $::Archer::archer}
    } else {
	wm title . "Archer"
	wm iconbitmap . -default [file join $env(ARCHER_HOME) archer.ico]
	set ::Archer::archer [Archer .\#auto]
	set size [wm maxsize .]
        set width [expr {[lindex $size 0] - 8}]
        set height [expr {[lindex $size 1] - 40}]
	pack $::Archer::archer -expand yes -fill both
	wm geometry . "$width\x$height+0+0"
	wm protocol . WM_DELETE_WINDOW [list exitArcher $::Archer::archer]
    }

    $::Archer::archer configure -quitcmd [list exitArcher $::Archer::archer]

    update
}

# TCL script execution start HERE!
wm withdraw .

# start splash screen
createSplashScreen
 
# do main procedure
main
set ::Archer::showWindow 1
@


1.1.2.2
log
@Look for archer.ico in doc/html/manuals/archer
@
text
@d46 4
a51 4
lappend auto_path [file join $dir tclscripts sdialogs]
lappend auto_path [file join $dir tclscripts sdialogs scripts]
lappend auto_path [file join $dir tclscripts swidgets]
lappend auto_path [file join $dir tclscripts swidgets scripts]
d240 1
a240 2
	wm iconbitmap $::Archer::archer -default \
	    [file join $env(ARCHER_HOME) doc html manuals archer archer.ico]
d248 1
a248 2
	wm iconbitmap . -default \
	    [file join $env(ARCHER_HOME) doc html manuals archer archer.ico]
@


1.1.2.3
log
@Mods for running on non-Windows platforms
@
text
@d6 3
a8 3
# restart using bwish \
exec ${ARCHER_HOME}/bin/bwish $0 $@@
#exec ${ARCHER_HOME}/bin/bwish_d $0 $@@
a37 8
if {$tcl_platform(os) == "Windows NT"} {
    set sdir ""
} else {
    set sdir [file join share brlcad 7.4.1]
}

set brlDataPath [bu_brlcad_data ""]

a45 2
lappend auto_path [file join $dir lib blt2.4]
lappend auto_path [file join $dir lib blt2.4 dd_protocols]
d47 7
a53 7
lappend auto_path [file join $brlDataPath tclscripts]
lappend auto_path [file join $brlDataPath tclscripts sdialogs]
lappend auto_path [file join $brlDataPath tclscripts sdialogs scripts]
lappend auto_path [file join $brlDataPath tclscripts swidgets]
lappend auto_path [file join $brlDataPath tclscripts swidgets scripts]
lappend auto_path [file join $brlDataPath tclscripts lib]
lappend auto_path [file join $brlDataPath tclscripts archer]
d58 9
a77 9
set archerDebug 0
package require Archer 1.0
package require Iwidgets
package require Swidgets

# This must be done after loading BLT (that potentially gets it wrong)
set blt_library [file join $dir lib blt2.4]
lappend auto_path $blt_library

a159 1
    global brlDataPath
d164 1
a164 2
#	set image [image create photo -file [file join $env(ARCHER_HOME) tclscripts archer images aboutArcher.png]]
	set image [image create photo -file [file join $brlDataPath tclscripts archer images aboutArcher.png]]
d171 1
a171 1
    $::Archer::splash configure -background $::Archer::SystemWindow
a235 2
    global brlDataPath
    global tcl_platform
d240 2
a241 6
	if {$tcl_platform(os) == "Windows NT"} {
	    #wm iconbitmap $::Archer::archer -default \
	    #[file join $env(ARCHER_HOME) doc html manuals archer archer.ico]
	    wm iconbitmap $::Archer::archer -default \
		[file join $brlDataPath html manuals archer archer.ico]
	}
d249 2
a250 6
	if {$tcl_platform(os) == "Windows NT"} {
	    #wm iconbitmap . -default \
	    #[file join $env(ARCHER_HOME) doc html manuals archer archer.ico]
	    wm iconbitmap . -default \
		[file join $brlDataPath html manuals archer archer.ico]
	}
@


1.1.2.4
log
@Set brlDataPath depending on the platform
@
text
@d39 1
a39 1
    set brlDataPath $env(ARCHER_HOME)
d41 1
a41 1
    set brlDataPath [bu_brlcad_data ""]
d44 1
@


1.1.2.5
log
@Change brlDataPath to brlcadDataPath
@
text
@d39 1
a39 1
    set brlcadDataPath $env(ARCHER_HOME)
d41 1
a41 1
    set brlcadDataPath [bu_brlcad_data ""]
d56 7
a62 7
lappend auto_path [file join $brlcadDataPath tclscripts]
lappend auto_path [file join $brlcadDataPath tclscripts sdialogs]
lappend auto_path [file join $brlcadDataPath tclscripts sdialogs scripts]
lappend auto_path [file join $brlcadDataPath tclscripts swidgets]
lappend auto_path [file join $brlcadDataPath tclscripts swidgets scripts]
lappend auto_path [file join $brlcadDataPath tclscripts lib]
lappend auto_path [file join $brlcadDataPath tclscripts archer]
d169 1
a169 1
    global brlcadDataPath
d175 1
a175 1
	set image [image create photo -file [file join $brlcadDataPath tclscripts archer images aboutArcher.png]]
d247 1
a247 1
    global brlcadDataPath
d257 1
a257 1
		[file join $brlcadDataPath html manuals archer archer.ico]
d270 1
a270 1
		[file join $brlcadDataPath html manuals archer archer.ico]
@


1.1.2.6
log
@Minor cleanup
@
text
@d46 10
a55 10
lappend auto_path [file join $env(ARCHER_HOME) lib]
lappend auto_path [file join $env(ARCHER_HOME) lib tcl8.4]
lappend auto_path [file join $env(ARCHER_HOME) lib tk8.4]
lappend auto_path [file join $env(ARCHER_HOME) lib itcl3.3]
lappend auto_path [file join $env(ARCHER_HOME) lib itk3.3]
lappend auto_path [file join $env(ARCHER_HOME) lib iwidgets4.0.2]
lappend auto_path [file join $env(ARCHER_HOME) lib iwidgets4.0.2 scripts]
lappend auto_path [file join $env(ARCHER_HOME) lib blt2.4]
lappend auto_path [file join $env(ARCHER_HOME) lib blt2.4 dd_protocols]
lappend auto_path [file join $env(ARCHER_HOME) lib sdb]
d84 1
a84 1
set blt_library [file join $env(ARCHER_HOME) lib blt2.4]
@


1.1.2.7
log
@Change archerDebug to Archer::debug; move SetNormalCursor and SetWaitCursor totclscripts/archer/cursor.tcl
@
text
@d78 1
a78 1
set Archer::debug 0
d87 48
@


1.1.2.8
log
@Change the location where archer.ico is found. This affects only the windows version
@
text
@d126 1
d206 2
d209 1
a209 1
		[file join $brlcadDataPath doc html manuals archer archer.ico]
d219 2
d222 1
a222 1
		[file join $brlcadDataPath doc html manuals archer archer.ico]
@


