#
# Startup Script for VisageWS
#
limit coredumpsize 0

# New in amira 3.1: the message window and the main window are no longer
# shown automatically but by means of these two Tcl commands. Starting
# amira with a modified init script allows you to suppress these windows.
# theMsg show
# theMain show

# This function should not be defined. Otherwise amira doesn't report
# errors properly. Tcl will pass them automatically to this function and
# the return value will be thrown away in most cases.
# proc unknown {args} {
#     return "invalid command name \"$args\""
# }

# Load Resource Files
#   1. $AMIRA_ROOT/share/resources/[A-z]*.rc
#   2. $AMIRA_LOCAL/share/resources/[A-z]*.rc

foreach file [glob -nocomplain \
                  ${AMIRA_ROOT}/share/resources/\[A-z\]*.rc \
                  ${AMIRA_ROOT}/share/script-objects/*.rc] {
    source $file 0 
}

if { $AMIRA_LOCAL != $AMIRA_ROOT } { 
    foreach file [glob -nocomplain \
                      ${AMIRA_LOCAL}/share/resources/\[A-z\]*.rc \
                      ${AMIRA_LOCAL}/share/script-objects/*.rc] { 
        source $file 0 
    } 
}

set hideNewModules 1
# load ${AMIRA_ROOT}/data/colormaps/*
set hideNewModules 0

proc exists { cmd } { llength [ info commands $cmd ] }

# This procedure is always called before a Tcl-script is parsed. It removes
# global variables matching TMPIO*. These variables are used by the LoadCmd
# mechanism when multiple data objects are created from a single file.
proc remove_tmpio { } {
    set var [ info globals ]
    set n [ llength $var ]
    for { set i 0 } { $i<$n } { incr i } {
        if { [ string match TMPIO* [ lindex $var $i ] ] } {
            global [ lindex $var $i ]
            unset [ lindex $var $i ]
        }
    }
}

# Call second startup scripts for all packages, now with all resources loaded,
# such that the .rc2 scripts may contain additional startup routines.
foreach file [glob -nocomplain ${AMIRA_ROOT}/share/resources/\[A-z\]*.rc2 ${AMIRA_ROOT}/share/scro/*.rc2] {
    source $file 0 }

if { $AMIRA_LOCAL != $AMIRA_ROOT } { foreach file [glob -nocomplain \
    ${AMIRA_LOCAL}/share/resources/\[A-z\]*.rc2 ${AMIRA_LOCAL}/share/scro/*.rc2] { source $file 0 } }

# Set this variable for the render server version:
#set ExamineNoBorder 0

if { [catch {create HxExamine Examine} res] } {
    echo "Could not create HxExamine module, check shared libraries."
    exit
}

# Examine showMaximized
Examine show


