
# DOC DONE

# This code creates the user interface for the mesh editor.
#
# Copyright (c) 1997 Pacific Marketing and Consulting, Inc,
#       and ICEM Systems, GmbH.  All rights reserved.
# Author:  Wayne A. Christopher, wayne@icemcfd.com
# $Revision$ on $Date$

# This file contains special comments of the form ## html ... which are
# used to automatically generate documentation

# ------------------------------------------------------------------
## <h3>Display functions</h3>

## Set the current viewing position.  <b>What</b> may be:
## <ul>
## <li> <b>home</b> : set the home position
## </ul>

proc ic_view {what} {
    global tdv_default batch_mode
    if $batch_mode return
    switch $what {
        home { tdv_home $tdv_default }
    }
}

## Turn visibility on or off for different objects.  The <em>on</em> argument
## should be 0 or 1.
## <b>type</b> is one of <b>geometry</b>, <b>unstruct</b>, or <b>family</b>.
## In the case of <b>geometry</b>, <b>what</b> should be one of
## <b>surface</b>, <b>curve</b>, <b>point</b>, <b>material</b>,
## <b>density</b>, or <b>loop</b>.  In the case of <b>unstruct</b>, it should
## be one of the element type names like
## <b>TETRA_4</b>.  In the case of <b>family</b>, it should
## be a family name.

proc ic_visible {type what on} {
    # Just call the function in the GUI interpreter ...
    gui_change_visibility $type $what $on
}

## Set the color to use for drawing objects in the named family.  This applies
## to geometry and mesh.

proc ic_set_family_color_for_name {name color} {
    global projlib batch_mode
    if $batch_mode return
    set_family_color_for_name $name $color
    foreach {t n} [ic_geo_get_objects all $name] {
	set bsp [$projlib get_object_by_name $t $n]
	if {$bsp != ""} { $bsp configure -color $color -only_to_change_color 1}
    }
    ic_uns_families_changed
    ic_str_families_color_changed $name $color
}

## Update the display in the GUI.
## <em>mode</em> is one of:
##    <b>all</b>, <b>unstruct</b>, <b>struct</b>, <b>geom</b>,
##    <b>"" implies all</b>
## <em>new_fams</em> determines whether or not to do update the
##    family list in the GUI.
## <em>types</em> this list allows one to make visible entity types
##    appropriate to the mode (e.g.: {TRI_3} for unstruct).

proc ic_display_update {{mode ""} {new_fams 1} {types ""}} {
    global batch_mode
    if $batch_mode return
    # Just call the function in the GUI interpreter ...
    display_update $mode $new_fams $types
    # For new GUI ...
    aie_create_parts_in_tree_if_needed
    if {$mode == "" || $mode == "all" || $mode == "unstruct"} {
        aie_updateMeshVis
    }
    if {$mode == "" || $mode == "all" || $mode == "geom"} {
        aie_updateGeoVis
    }
}
