
# 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
#
# All the menu-specific stuff, logos, etc go in this file.  This makes it
# easier to create flavored versions of med with different structures.

# Toolbars -----------

command_make_toolbar "File commands" 1 {
    "Open project"
    "Save project"
    "Print screen"
}

command_make_toolbar "Viewing commands" 1 {
    "Home position"
    "Zoom in"
    "Scale to fit"
}

command_make_toolbar_space 1

command_make_toolbar "Editing commands" 1 {
    "Undo operation"
    "Redo operation"
}

command_make_toolbar "Geometry mode" 1 {
    { cascade 
	"Geometry mode: surface"
	"Geometry mode: curve"
	"Geometry mode: point"
	"Geometry mode: material"
	"Geometry mode: loop"
	"Geometry mode: density"
    }
}

# Key bindings ---------

command_set_hotkeys {
    F1 "Help"
    z "Zoom in"
    o "Open project"
}

# Pulldown menus ---------

command_make_menu "Help" "" "right button" {}

command_make_menu "File" "" left {
    { "Open project" }
    { "Save project" }
    { "Save project as" }
    { "Close project" }
    { "Print screen" }
    { "Quit" }
    separator
    { "Project dir" "" cascade {
	{ disabled "Copy project" }
	{ disabled "Rename project" }
	{ disabled "Delete project" }
	{ "Archive project" }
	{ "Un-archive project" }
    } }
    { disabled "Tetin file" "" cascade {
	{ "Load tetin file" }
	{ "Merge tetin file" }
	{ "Save tetin file" }
	{ "Unload tetin file" }
	{ "Delete tetin file" }
	{ "Create empty tetin file" }
	{ "Change family_boco file name" }
    } }
    { "Domain file" "" cascade {
	{ disabled "Load domain file" }
        { disabled "Save domain file" }
        { disabled "Unload domain file" }
        { disabled "Delete domain file" }
	{ "Convert structured to unstructured" }
        { "Convert structured to single block" }
    } }
    { disabled "B.C. file" "" cascade {
        { "Save family_boco file" }
    } }
    { "Import geometry" "" cascade {
        { "Import CATIA4 as geometry" }
        { "Import DDN" }
        { "Import domain file as geometry" }
        { "Import Fluent as geometry" }
        { "Import IGES" }
        { "Import Nastran as geometry" }
        { "Import Plot3d as geometry" }
        { "Import Patran as geometry" }
        { "Import STL as geometry" }
        { "Import TecPlot as geometry" }
        { "Import UG" }
        { "Import GEMS" }
        { "Import VRML as geometry" }
	separator
        { "Convert IGES to DDN" }
        { "Convert TVDA to DDN" }
        { "Convert DXF to DDN" }
        { "Convert PreBFC to DDN" }
    } }
    { "Export geometry" "" cascade {
        { "Convert Tetin to IGES" }
        { "Convert Tetin to DDN" }
        { "Convert Tetin to BrepXML" }
        { "Convert DDN to IGES" }
        { "Convert DDN to TVDA" }
        { "Convert DDN to DXF" }
    } }
    { "Options" "" cascade {
        { "Edit options" }
        { "Edit pathnames" }
        { "Change ICEM_ACN" }
        { "Mouse bindings" }
        { "Coord systems" }
	{ "Edit directories" }
    } }
    { "Utilities" "" cascade {
        { "Change directory" }
        { "Convert directory style" }
        { "Text Editor" }
        { "Convert CGM to Postscript" }
	{ "License" "" cascade {
	    { "Start license server" }
	    { "Reconnect to license server" }
	    { "Check license usage" }
	} }
	{ "Check system info" }
        { "Clear file locks" }
	{ "Shell window" "" cascade {
	    { "Shell window in current dir" }
	    { "Shell window in transfer dir" }
	    { "Shell window in mesh dir" }
	} }
        { "Play game" }
    } }
    { "Scripting" "" cascade {
        { "Run script" }
        { "Replay mode" }
        { "View programmer's guide" }
    } }
    { "Annotations" }
    { "Import mesh" "" cascade {
        { "Import Ansys as mesh" }
        { "Import CGNS as mesh" }
        { "Import Fluent as mesh" }
        { "Import LS-Dyna as mesh" }
        { "Import Nastran as mesh" }
        { "Import Patran as mesh" }
	{ "Import Plot3d as mesh" }
        { "Import SAUNA as mesh" }
        { "Import Starcd as mesh" }
        { "Import STL as mesh" }
        { "Import TecPlot as mesh" }
        { "Import by a specfied reader" }
    } }
    { "DDN part" "" cascade {
        { "Move DDN part to other dir" }
        { "Copy DDN part to other dir" }
        { "Delete DDN part" }
        { "Copy DDN part" }
        { "Rename DDN part" }
    } }
}

command_make_menu "View" "" left {
    { "Location" }
    { "Distance" }
    { "Angle" }
    { "Bounding box" }
    separator
    { "Add marker" }
    { "Clear markers" }
    separator
    { "Track mouse" }
    { "Depthcue" }
    { "Coord axes" }
    { "Origin marker" }
    separator
    { "Set background" }
    { "Manage coord. systems" }
    { "Edit toolbars" }
    { "Tcl console" }
}

command_make_menu "Orient" "" left {
    { "Home position" }
    { "Zoom in" }
    { "Scale to fit" }
    { "Orient positive X" }
    { "Orient negative X" }
    { "Orient positive Y" }
    { "Orient negative Y" }
    { "Orient positive Z" }
    { "Orient negative Z" }
    { "Isometric view" }
    { "Reverse orientation" }
    { "Nearest axis" }
}

command_make_menu "Geometry" "" left {
    { "DDN tools" "" cascade {
	{ "DDN" }
	{ "Comak" }
	{ "Input" }
	{ "Frontal (in DDN)" }
    } }
    { "Bound conds" }
    { "Repair" "" cascade {
	{ "Create topology" }
	{ "Fix gaps (CAD)" }
	{ "Remove feature (CAD)" }
	{ "Fix gaps (faceted)" }
	{ "Delete duplicate facets" }
	{ "Delete unattached geometry" }
    } }
    { "Utilities" "" cascade {
	{ "Frontal area" }
	{ "Transfer facets -> mesh" }
	{ "Transfer mesh -> facets" }
    } }
    { "Cartesian setup" "" cascade {
	{ "Init Cartesian (minimal)" }
	{ "Init  Cartesian(keypoints)" }
	{ "Load cart file" }
	{ "Save cart file" }
	separator
	{ "Display Cartesian stations" }
	{ "Add Cartesian stations" }
	{ "Delete Cartesian stations" }
	{ "Edit Cartesian stations" }
	{ "Edit Cartesian ranges" }
	{ "Edit Cartesian cyl params" }
	separator
	{ "Cartesian mesh" }
	{ "Cylindrical mesh" }
    } }
    { "Geometry mode" "" cascade {
	{ "Geometry mode: surface" }
	{ "Geometry mode: curve" }
	{ "Geometry mode: point" }
	{ "Geometry mode: material" }
	{ "Geometry mode: loop" }
	{ "Geometry mode: density" }
    } }
    { "Create" "" variable_cascade geometry_mode {
	{ surface "Create surface" {
	    { "Segment surface" }
	    { "Create surface from 4 points" }
	    { "Create surface from 8 points (box)" }
	    { "Create surface from convex hull" }
	    { "From 2 curves" }
	    { "Project curve to surface" }
	} }
	{ curve "Create curve" {
	    { "Segment curve" }
	    { "Extract curve from surface" }
	    { "Intersect surfaces" }
	    { "Create curve from points" }
	    { "Project to surface" }
	} }
	{ point "Create point" {
	    { "Extract points from curve" }
	    { "Create points via screen select" }
	    { "Create points via screen midpoint" }
	    { "Create points via explicit location" }
	    { "Create points via curve intersections" }
	} }
	{ material "Create material" {
	    { "Create material via screen select" }
	    { "Create material via screen midpoint" }
	    { "Create material via explicit location" }
	} }
	{ density "Create density" {
	    { "Create density via screen select" }
	} }
	{ loop "Create loop" {
	    { "Create loop via screen select" }
	    { "Create loop from surfaces" }
	    { "Create loop from each surface" }
	} }
    } }
    { "Delete geometry" "" cascade {
	{ "Delete selected objects" }
	{ "Delete last created objects" }
	{ "Delete all visible objects" }
	{ "Delete all blanked objects" }
    } }
    { "Modify" "" variable_cascade geometry_mode {
	{ surface "Modify surfaces" {
	    { "Untrim surface" }
	    { "Rename surface" }
	    { "Convert surface to facets" }
	    { "Merge surfaces" }
	    { "Coarsen surface" }
	    { "Edit triangles" "" cascade {
		{ "Create surface triangles" }
		{ "Delete surface triangles" }
		{ "Restrict surface triangles" }
		{ "Split surface triangles" }
		{ "Move to other surface" "" cascade {
		    { "Move surface triangles to existing surface" }
		    { "Move surface triangles to new surface" }
		} }
	    } }
	    { "Edit edges" "" cascade {
		{ "Split edges" }
		{ "Swap edges" }
	    } }
	    { "Move nodes" "" cascade {
		{ "Move surface nodes to location" }
		{ "Move surface nodes on screen" }
		{ "Move surface nodes on plane" }
		{ "Move surface nodes on line" }
		{ "Move surface nodes in direction" }
	    } }
	    { "Merge nodes" "" cascade {
		{ "Merge surface nodes interactive" }
		{ "Merge surface nodes by tolerance" }
	    } }
	} }
	{ curve "Modify curves" {
	    { "Rename curve" }
	    { "Convert curve to facets" }
	    { "Merge curves" }
	    { "Reapproximate curve" }
	    { "Edit segments" "" cascade {
		{ "Create curve segments" }
		{ "Delete curve segments" }
		{ "Restrict curve segments" }
		{ "Split curve segments" }
		{ "Move to other curve" "" cascade {
		    { "Move curve segments to existing" }
		    { "Move curve segments to new" }
		} }
	    } }
	    { "Move nodes" "" cascade {
		{ "Move curve nodes to location" }
		{ "Move curve nodes on screen" }
		{ "Move curve nodes on surfaces" }
		{ "Move curve nodes on plane" }
		{ "Move curve nodes on line" }
		{ "Move curve nodes in direction" }
		{ "Project curve nodes to surfaces" }
	    } }
	    { "Merge curve nodes" }
	} }
	{ point "Modify points" {
	    { "Rename point" }
	    { "New point position" }
	    { "Screen move point" }
	    { "Merge points" }
	} }
	{ material "Modify materials" {
	    { "Rename material" }
	    { "New material position" }
	    { "Screen move material" }
	} }
	{ density "Modify densities" {
	    { "Rename density" }
	    { "Move density corner" }
	} }
	{ loop "Modify loops" {
        } }
    } }
    { "Meshing parameters" "" cascade {
	{ "Model mesh params" }
	{ "Family mesh params" }
	{ "Surface mesh params" }
	{ "Curve mesh params" }
	{ "Point mesh params" }
	{ "Material mesh params" }
	{ "Loop mesh params" }
	{ "Density mesh params" }
    } }
    { "Change geometry family" "" cascade {
	{ "Change surface family" }
	{ "Change curve family" }
	{ "Change point family" }
	{ "Change material family" }
	{ "Change loop family" }
	{ "Change density family" }
    } }
    { "Copy/move geometry" "" cascade {
	{ "Copy/move whole model" }
	{ "Copy/move families" }
	{ "Copy/move selected entities" }
    } }
}

command_make_menu "Create mesh" "" left {
    { "Hexa" "" cascade {
	{ "Hexa interactive" }
	{ "Hexa batch" }
	{ "Convert Mulcad to Hexa" }
    } }
    { "Tetra" "" cascade {
	{ "Tetra batch from CAD" }
	{ "Tetra interactive from CAD" }
	{ "Tetra from surface mesh" }
    } }
    { "Global" }
    { "Prism" }
    { "Quad" }
    { "AutoHexa" }
    separator
    { "Mulcad/Padamm" "" cascade {
	{ "Run Mulcad" }
	{ "Clean up Mulcad scratch files" }
    } }
    { "P-Cube" "" cascade {
	{ "P-Cube" }
	{ "Delete P-Cube undo files" }
	{ "Set P-Cube tolerance" }
    } }
    { "Cart3D" }
}

command_make_menu "Edit mesh" {data_available(mesh)} left {
    { "Copy/move mesh" }
    { "Smooth elements" }
    { "Refine elements" }
    { "Coarsen elements" }
    { "Merge unstructured meshes" }
    { "Extrude elements" }
    { "Uncouple elements" }
    { "Optimize bandwidth" }
    { "Repair unstructured mesh" }
    { "Diagnostics" data_available(mesh) variable_cascade data_available(unstruct) {
	{ 0 "Structured diagnostics" {
	    { "Structured quality metrics" }
	    { "Domain orientation" }
	    { "Structured summary info" }
	    { "Full topo info" }
	} }
	{ 1 "Unstructured diagnostics" {
	    { "Information" "" cascade {
		{ "Unstructured summary info" }
		{ "Unstructured element info" }
		{ "Unstructured node info" }
		{ "Unstructured domain file info" }
		{ "Family boundary edges" }
		{ "Spanning edges" }
		{ "Max vertex degree" }
	    } }
	    { "Which elements" "" cascade {
		{ "Diagnostic elements: All" }
		{ "Diagnostic elements: Active" }
		{ "Diagnostic elements: Subset" }
	    } }
	    { "Unstructured quality metrics" }
	    { "Check mesh" }
	    { "Check edges" }
	    { "Errors" "" cascade {
		{ "All unstructured errors" }
		separator
		{ "Duplicate elements" }
		{ "Volume orientation" }
		{ "Surface orientation" }
		{ "Uncovered faces" }
		{ "Missing internal faces" }
		{ "Periodic problems" }
	    } }
	    { "Possible problems" "" cascade {
		{ "Overlapping elements" }
		{ "Delaunay violations" }
		{ "Single edges" }
		{ "2 single edges" }
		{ "Multiple edges" }
		{ "Single/multiple edges" }
		separator
		{ "Triangle boxes" }
		{ "Non-manifold vertices" }
		{ "Spike vertices" }
		{ "Stand-alone surface mesh" }
		separator
		{ "Disconnected vertices" }
	    } }
	} }
    } }
    { "Change type" "" cascade {
	{ "Prisms -> Tetras" }
	{ "Linear -> Quadratic" }
	{ "Quadratic -> Linear" }
	{ "1 Quad -> 2 Tri" }
	{ "Tri -> Quad" }
	{ "12 Tetra -> 1 Hexa" }
	{ "1 Tetra -> 4 Hexa" }
	{ "1 Prism -> 3 Tetra" }
	{ "1 Pyra -> 2 Tetra" }
	{ "All -> Tetra" }
    } }
    { "Change family" "" variable_cascade data_available(unstruct) {
	{ 0 "" {
	    { "Change domain family" }
	    { "Change subface family" }
	    { "Change edge family" }
	    { "Change vertex family" }
	} }
	{ 1 "" {
	    { "Change element family" }
	    { "Flood fill" }
	} }
    } }
    { "Utilities" "" cascade {
	{ "Edit properties" }
	{ "Make consistent" }
	{ "Check edges" }
	{ "Flood fill" }
    } }
    { "Edit nodes" "" variable_cascade data_available(unstruct) {
	{ 0 "" {
	    { "Move struct node exact" }
	    { "Move struct node screen" }
	    { "Move struct nodes on geometry" }
	} }
	{ 1 "" {
	    { "Move" "" cascade {
		{ "Move unstruct node (invert)" }
		{ "Move unstruct node (no invert)" }
		{ "Move unstruct node (exact)" }
	    } }
	    { "Merge" "" cascade {
		{ "Merge unstruct nodes (interactive" }
		{ "Merge unstruct nodes (all, tolerance)" }
		{ "Merge unstruct nodes (selected, tolerance)" }
		{ "Merge unstruct nodes (visible, tolerance)" }
	    } }
	    { "Delete unstruct nodes" }
	    { "Project" "" cascade {
		{ "Project unstruct nodes to surfaces" }
		{ "Project unstruct nodes to curves" }
		{ "Project unstruct nodes to points" }
		{ "Project unstruct nodes to current type" }
		{ "Unproject unstruct nodes" }
		{ "Project unstruct nodes automatic" }
		{ "Project unstruct nodes from surves to surfaces" }
	    } }
	    { "Split" "" cascade {
		{ "Split nodes manifold" }
		{ "Split nodes non-manifold" }
	    } }
	    { "Set projection mode" "" cascade {
		{ "Projection mode: active families" }
		{ "Projection mode: all families" }
		{ "Projection mode: no projection" }
	    } }
	    { "Periodic" "" cascade {
		{ "Make nodes periodic" }
		{ "Make nodes not periodic" }
	    } }
	    { "Redistribute prism edge" }
	} }
    } }
    { "Edit elements" "data_available(unstruct)" cascade {
	{ "Create elements" }
	{ "Delete" "" cascade {
	    { "Delete selected elements" }
	    { "Delete all blanked elements" }
	} }
	{ "Change element orientation" }
	{ "Split" "" cascade {
	    { "Split selected elements" }
	    { "Split internal faces" }
	    { "Split double walls" }
	    { "Split prisms" }
	} }
	{ "Couplings" "" cascade {
	    { "Create couplings" }
	    { "Clear couplings" }
	} }
        { "Connectors"  "" cascade {
		{ "Edit/run bolt-holes" }
		{ "Edit/run connectors" }
		{ "Edit/run seam-welds" }
		{ "Edit/run spot-welds" }
	} }
	{ "Renumber elements" }
    } }
    { "Edit edges" "data_available(unstruct)" cascade {
	{ "Split" "" cascade {
	    { "Split selected edges" }
	    { "Split spanning edges" }
	} }
	{ "Swap" "" cascade {
	    { "Swap edges (simple)" }
	    { "Swap edges (try harder)" }
	    { "Swap edges (automatic)" }
	} }
    } }
    { "Edit domains" data_available(struct) cascade {
	{ "Reorient domains" }
    } }
    { "Edit subfaces" data_available(struct) cascade {
	{ "Split subfaces" }
	{ "Merge subfaces" }
    } }
}

command_make_menu "Solution" "" left {
    { "Select solver" }
    { "Solver params" }
    { "Solver input" }
    { "Start solver" }
    { "Visual3" }
    { "OptiMesh" }
    { "RAMM-ICE" }
    { "Moving Mesh" }
    { "Y+" }
}
