
# 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 -----------

if { $from_Workbench == 1} {
	command_make_toolbar "File commands" 1 {
		"Save project"
		"Refresh Input Data"
		"Print screen"
		"Create image file"
	}
} else {
	command_make_toolbar "File commands" 1 {
		"New project"
		"Open project"
		"Save project"
		"Print screen"
		"Create image file"
	}
}

command_make_toolbar "Edit commands" 1 {
    "Undo"
    "Redo"
}

command_make_toolbar "Viewing options" 1 {
    "Home position"
    "Zoom in"
    "Scale to fit"
    "Rotate about screen normal"
    "One viewing window"
    "Four viewing windows"
    "Display object names"
}

command_make_toolbar "Orientation commands" 1 {
    "Orient positive X"
    "Orient positive Y"
    "Orient negative Z"
    "Isometric view"
    "Reverse orientation"
}

command_make_toolbar "Model and solve" 1 {
    "Power and temperature limits"
    "Generate mesh"
    "Radiation"
    "Check model"
    "Run solution"
    "Run optimization"
}

command_make_toolbar "Postprocessing" 1 {
    "Object face"
    "Plane cut"
    "Isosurface"
    "Point"
    "Surface probe"
    "Variation plot"
    "History plot"
    "Trials plot"
    "Transient settings"
    "Load solution ID"
    "Summary report"
    "Power and temperature values"
}

# Menus that go near the objects.

command_make_toolbar "Object modification" "1 object_tools" {
    "Edit object"
    "Delete object"
    "Move object"
    "Copy object"
}

#Ref:US32032-TA73951 - Seperated on account of Intel Req.
command_make_toolbar "Alignment" "1 object_tools" {
    {multiple "Align and morph faces" "Align faces - move only" }
    {multiple "Align and morph edges" "Align edges - move only" }
    {multiple "Align and morph vertices" "Align vertices - move only" }
    "Align object centers"
    "Align face centers"
    "Morph faces"
    "Morph edges"
}

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

# Note that we don't put stuff like home and zoom-in here because that is
# handled by the tdv code that knows about multiple viewing windows.
# *However* we do have to put in information about these hotkeys so we can
# get the right annotations in the menus.


if { $from_Workbench == 1} {
	command_set_hotkeys {
		F1 "Help"
	        Control-f "Find"
		Control-f "Find in tree"
		Control-e "Edit object or postprocessing object"
		Delete "Delete object"
		Control-a "Toggle object active"
		Control-v "Toggle object visible"
	        Control-h "Toggle object shading"
		Control-t "Open/close tree node"
		Control-m "Open/close model subtree"
		Control-s "Save project"
		Control-p "Print screen"
		Control-z "Undo"
		Control-r "Redo"
		Control-x "Move object"
		Control-c "Copy object"
		Control-w "Toggle shading type"
		Control-l "Reload main version"
		Control-d "Refresh Input Data"
	}
} else {
	command_set_hotkeys {
		F1 "Help"
	        Control-f "Find"
		Control-f "Find in tree"
		Control-e "Edit object or postprocessing object"
		Delete "Delete object"
		Control-a "Toggle object active"
		Control-v "Toggle object visible"
	        Control-h "Toggle object shading"
		Control-t "Open/close tree node"
		Control-m "Open/close model subtree"
		Control-s "Save project"
		Control-p "Print screen"
		Control-z "Undo"
		Control-r "Redo"
		Control-x "Move object"
		Control-c "Copy object"
		Control-n "New project"
		Control-o "Open project"
		Control-w "Toggle shading type"
		Control-l "Reload main version"
	}
}

command_set_hotkeys_tdv {
    h "Home position"
    z "Zoom in"
    s "Scale to fit"
    Shift-x "Orient negative X"
    Shift-y "Orient positive Y"
    Shift-z "Orient negative Z"
    Shift-r "Reverse orientation"
    Shift-i "Isometric view"
    Shift-question "Print shortcuts"
    F5 "Set wireframe offset"
    F6 "Set wireframe offset to 0"
    F7 "Increment wireframe offset"
    F8 "Decrement wireframe offset"
    F9 "Toggle shift3 button"
}

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

if { $from_Workbench == 1} {
	set cmds {
		{ "Refresh Input Data" }
		{ "Merge project" }
		{ "Reload main version" }
		separator
		{ "Save project" }
		separator
		{ "Import" "" cascade {
		{ "Import IGES points+lines" }
		separator
		{ "Import IGES/Step surfaces+curves" }
		{ "Import Tetin surfaces+curves" }
		separator
		{ "Import CSV/Excel" }
                { "IDF file" "" cascade {
                        { "New board" }
                        { "Update board" }
                } }
		separator
		{ "Powermaps" "" cascade {
			{ "Apache Sentinel TI profile" }
			{ "Cadence tab file" }
			{ "Cadence Stacked Die tab files" }
			{ "Gradient Firebolt i2p file" }
			{ "SIwave profile" }
		} } 
		{ "Import Networks" } 
		} }
		{ "Export" "" cascade {   
		{ "Export CSV/Excel" }
		{ "Export IGES" }
		{ "Export Step" }
		{ "Export Tetin" }
		{ "Export IDF file" }
		separator 
                { "Export Networks" }
		} }
		{ "EM Mapping" "" cascade {
		{ "Volumetric heat losses" }
		{ "Surface heat losses" }
		} }
		separator
		{ "Pack project" }
	}
} else {
        if [expr $release_vers % 2] {
		set cmds {
			{ "New project" }
			{ "Open project" }
			{ "Merge project" }
			{ "Reload main version" }
			separator
			{ "Save project" }
			{ "Save project as" }
			separator
			{ "Import" "" cascade {
			{ "Import IGES points+lines" }
			separator
			{ "Import IGES/Step surfaces+curves" }
			{ "Import Tetin surfaces+curves" }
			separator
			{ "Import CSV/Excel" }
                        { "IDF file" "" cascade {
                                { "New board" }
                                { "Update board" }
                        } }
			separator
			{ "Powermaps" "" cascade {
				{ "Apache Sentinel TI profile" }
				{ "Cadence tab file" }
				{ "Cadence Stacked Die tab files" }
				{ "Gradient Firebolt i2p file" }
				{ "SIwave profile" }
			} }
			{ "Import Networks" }    
			{ "Import JEDEC PTD file" } 
			} }
			{ "Export" "" cascade {   
			{ "Export CSV/Excel" }
			{ "Export IGES" }
			{ "Export Step" }
			{ "Export Tetin" }
			{ "Export IDF file" }
			separator                
			{ "Export Networks" }
			{ "Export JEDEC PTD file" } 
			} }
			{ "EM Mapping" "" cascade {
			{ "Volumetric heat losses" }
			{ "Surface heat losses" }
			} }
			separator
			{ "Unpack project" }
			{ "Pack project" }
		}
        } else {
                set cmds {
                        { "New project" }
                        { "Open project" }
                        { "Merge project" }
                        { "Reload main version" }
                        separator
                        { "Save project" }
                        { "Save project as" }
                        separator
                        { "Import" "" cascade {
                        { "Import IGES points+lines" }
                        separator
                        { "Import IGES/Step surfaces+curves" }
                        { "Import Tetin surfaces+curves" }
                        separator
                        { "Import CSV/Excel" }
                        { "IDF file" "" cascade {
                                { "New board" }
                                { "Update board" }
                        } }
                        separator
                        { "Powermaps" "" cascade {
                                { "Apache Sentinel TI profile" }
                                { "Cadence tab file" }
                                { "Cadence Stacked Die tab files" }
                                { "Gradient Firebolt i2p file" }
                                { "SIwave profile" }
                        } }
                        { "Import Networks" }
                        } }
                        { "Export" "" cascade {
                        { "Export CSV/Excel" }
                        { "Export IGES" }
                        { "Export Step" }
                        { "Export Tetin" }
                        { "Export IDF file" }
                        separator
                        { "Export Networks" }
                        } }
                        { "EM Mapping" "" cascade {
                        { "Volumetric heat losses" }
                        { "Surface heat losses" }
                        } }
                        separator
                        { "Unpack project" }
                        { "Pack project" }
                }
     }
}

#if $is_win {
#	lappend cmds { "Email project" }
#}


if { $from_Workbench == 1} {
	set cmds [concat $cmds {
	        separator
		{ "Cleanup" }
		{ "Print screen" }
		{ "Create image file" }
		{ "Command prompt" }
		{ "Close Icepak" }
	 
	}]
} else {
	set cmds [concat $cmds {
	        separator
		{ "Cleanup" }
		{ "Print screen" }
		{ "Create image file" }
		{ "Command prompt" }
		{ "Quit" }
	 
	}]
}


command_make_menu "File" "" left $cmds {keyboard f}

command_make_menu "Edit" "" left {
    { "Undo" }
    { "Redo" }
    separator
    { "Find" }
    { "Show clipboard" }
    { "Clear clipboard" }
    separator
    { "Snap to grid" }
    { "Preferences" }
    { "Annotations" }
} {keyboard e}

command_set_hotkeys_tdv {
    Control-e "Edit object"
    Control-a "Activate object"
    Control-t "Open/close tree node"
}

command_make_menu "View" "" left {
    { "Summary (HTML)" }
    separator
    { "Location" }
    { "Distance" }
    { "Angle" }
    { "Bounding box" }
    separator
    { "Traces" "" cascade {
	{ "Net info" }
	{ "Trace info" }
    } }
    separator
    { "Markers" "" cascade {
	{ "Add marker" }
	{ "Clear markers" }
    } }
    { "Rubber bands" "" cascade {
	{ "Add rubber band" }
	{ "Clear rubber bands" }
    } }
    separator
    { "Edit toolbars" }
    { "Default shading" "" cascade {
	{ "Wireframe shading" }
	{ "Solid shading" }
	{ "Solid/Wire shading" }
	{ "Hidden line shading" }
	separator
	{ "Selected solid shading" }
    } }
    { "Display" "" cascade {
	{ "Object names" "" cascade {
	    { "Current assembly object names" }
	    { "No object names" }
	    { "Selected object names" }
	} }
	separator
	{ "Coord axes" }
	{ "Visible grid" }
	{ "Origin marker" }
	{ "Display rulers" }
	{ "Display project title" }
	{ "Display ANSYS logo" }
	{ "Display current date" }
	{ "Display construction lines" }
	{ "Display construction points" }
	{ "Display mesh" }
	{ "Mouse position" }
	{ "Depthcue" }
	{ "Tcl console" }
    } }
    { "Visible" "" cascade $visible_object_commands }
    { "Action" }
    separator
    { "Lights" }
} {keyboard v}

command_make_menu "Orient" "" left {
    { "Home position" }
    { "Isometric view" }
    { "Orient positive X" }
    { "Orient negative X" }
    { "Orient positive Y" }
    { "Orient negative Y" }
    { "Orient positive Z" }
    { "Orient negative Z" }
    { "Zoom in" }
    { "Scale to fit" }
    { "Reverse orientation" }
    { "Nearest axis" }
    { "Save user view" }
    { "Clear user views" }
    { "Write user views to file" }
    { "Read user views from file" }
} {keyboard o}

command_make_menu "Macros" "" left {} {keyboard a}

command_make_menu "Model" "" left {
    { "Create object" "" cascade {
	{ "Create blocks" }
	{ "Create blowers" }
	{ "Create enclosures" }
	{ "Create fans" }
	{ "Create heat exchangers" }
	{ "Create heat sinks" }
	{ "Create materials" }
	{ "Create networks" }
	{ "Create openings" }
	{ "Create packages" }
	{ "Create assemblies" }
	{ "Create printed circuit boards" }
	{ "Create periodic boundaries" }
	{ "Create plates" }
	{ "Create resistances" }
	{ "Create sources" }
	{ "Create grille" }
	{ "Create walls" }	
    } } 
    separator
    { "CAD data" }
    { "Radiation form factors" }
    separator
    { "Generate mesh" }
    separator
    { "Edit priorities" }
    { "Edit cutouts" }
    { "Create material library" }
    { "Power and temperature limits" }
    separator
    { "Check model" }
    { "Show objects by material"}
    { "Show objects by property"}
    { "Show objects by type" }
    { "Show metal fractions" }
} {keyboard m}

# command_make_menu "Tree" "" left {
#     { "Find in tree" }
#     { "Sort" "" cascade {
# 	{ "Sort tree by creation order" }
# 	{ "Sort tree alphabetically" }
# 	{ "Sort tree by meshing priority" }
#     } }
#     { "Organize objects" "" cascade {
# 	{ "Organize tree flat" }
# 	{ "Organize tree by types" }
# 	{ "Organize tree by types / subtypes" }
# 	{ "Organize tree by types / subtypes / shapes" }
#     } }
#     { "Close all tree nodes" }
#     { "Open all tree nodes" }
#     { "Close all model nodes" }
#     { "Open all model nodes" }
# } {keyboard t}

command_make_menu "Solve" "" left {
    { "Settings" "" cascade {
        { "Basic settings" }
	{ "Advanced settings" }
	{ "Parallel settings" }
    } }
    { "Patch temperatures" }
    separator
    { "Run solution" }
    { "Run optimization" }
    separator
    { "Solution monitor" }
    separator
    { "Define trials" }
    { "Define report" }
    separator
    { "Diagnostics" "" cascade {
	{ "Edit .cas file" }
	{ "Edit .diag file" }
	{ "Edit .uns_out file" }
	{ "Edit optimization log" }
    } }
} {keyboard s}

command_make_menu "Post" "" left {
    { "Object face" }
    { "Plane cut" }
    { "Isosurface" }
    { "Point" }
    { "Surface probe" }
    { "Min/max locations" }
    separator
    { "Convergence plot" }
    { "Variation plot" }
    { "3D Variation plot" }
    { "History plot" }
    { "Trials plot" }
    { "Network temperature plot" }
    separator
    { "Transient settings" }
    { "Load solution ID" }
    { "Postprocessing units" }
    { "Load post objects from file" }
    { "Save post objects to file" }
    { "Rescale vectors" }
    separator
    { "Create zoom-in model" }
    { "Power and temperature values" }
    { "Workflow data" "" cascade {
	{ "CFD Post/Mechanical" }
    } }
} {keyboard p}

command_make_menu "Report" "" left {
    { "HTML report" }
    { "Solution overview" "" cascade {
	{ "View solution overview" }
	{ "Create solution overview" }
    } }
    { "Show optimization/param results" }
    separator
    { "Summary report" }
    { "Point report" }
    { "Full report" }
    separator
    { "Network block values" }
    { "Fan operating points" }
    { "EM heat losses" }
    separator
    { "Write Autotherm file" }
    separator
    { "Export" "" cascade {
       { "Gradient Firebolt p2i file" }
       { "Cadence TPKG file" }
       { "SIwave temp data" }
       { "Sentinel TI HTC file" }
    } }
} {keyboard r}

command_make_menu "Windows" "" "left set_path toplevel(windows_menu)" {} {keyboard w}

command_make_menu "Help" "" left {
    { "Help" }
    { "Icepak on the Web" }
    { "Customer Portal" }
    { "List shortcuts" }
    separator
    { "About Icepak" }
} {keyboard h}

