--**********************
--  EHSD
--  STEERING MODE PAGE
--**********************

local mpcd_path = LockOn_Options.script_path.."MPCD/indicator/EHSD/"

dofile(LockOn_Options.script_path.."MPCD/indicator/MPCD_definitions.lua")
dofile(mpcd_path.."Global/EHSD_MAP_VIDEO.lua")
dofile(mpcd_path.."Global/EHSD_Route_Lines.lua")
dofile(mpcd_path.."Global/EHSD_MAP_OVLY_1.lua")
dofile(mpcd_path.."Global/EHSD_Compass_Rose.lua")
dofile(mpcd_path.."Global/EHSD_Menu.lua")

-- Navigation Arrows
local	ehsd_next_sp_arrow				= create_mpcd_textured_box( 180, 864, 198, 922)
		ehsd_next_sp_arrow.name			= "ehsd_next_sp_arrow"
		ehsd_next_sp_arrow.init_pos		= mpcd_btn_12_pos
		ehsd_next_sp_arrow.controllers	= {{"EHSD_PB12_Arrow"}}
Add_MPCD_VIDEO_Element(ehsd_next_sp_arrow)

local	ehsd_prev_sp_arrow				= create_mpcd_textured_box( 209, 864, 227, 924)
		ehsd_prev_sp_arrow.name			= "ehsd_prev_sp_arrow"
		ehsd_prev_sp_arrow.init_pos		= mpcd_btn_13_pos
		ehsd_prev_sp_arrow.controllers	= {{"EHSD_PB13_Arrow"}}
Add_MPCD_VIDEO_Element(ehsd_prev_sp_arrow)

local	ehsd_sp_number					= CreateElement "ceStringPoly"
		ehsd_sp_number.name				= "ehsd_sp_number"
		ehsd_sp_number.material			= mpcd_tpod_font
		ehsd_sp_number.init_pos			= { 0.95,  0.165, 0}
		ehsd_sp_number.alignment		= "RightCenter"
		ehsd_sp_number.formats			= {"%s"}
		ehsd_sp_number.stringdefs		= MPCD_large_font_size
		ehsd_sp_number.controllers		= {{"EHSD_PB12_PB13_Data"}}
Add_MPCD_VIDEO_Element(ehsd_sp_number)

-- AHRS Arrows
local	ehsd_ahrs_dg_arrow				= create_mpcd_textured_box( 175, 603, 235, 614)
		ehsd_ahrs_dg_arrow.name			= "ehsd_ahrs_dg_arrow_left"
		ehsd_ahrs_dg_arrow.init_pos		= mpcd_btn_07_pos
		ehsd_ahrs_dg_arrow.controllers	= {{"EHSD_PB07_Arrow"}}
Add_MPCD_VIDEO_Element(ehsd_ahrs_dg_arrow)

local	ehsd_ahrs_dg_arrow				= create_mpcd_textured_box( 175, 574, 235, 585)
		ehsd_ahrs_dg_arrow.name			= "ehsd_ahrs_dg_arrow_right"
		ehsd_ahrs_dg_arrow.init_pos		= mpcd_btn_08_pos
		ehsd_ahrs_dg_arrow.controllers	= {{"EHSD_PB08_Arrow"}}
Add_MPCD_VIDEO_Element(ehsd_ahrs_dg_arrow)

local	ehsd_ahrs_dg_hdg				= CreateElement "ceStringPoly"
		ehsd_ahrs_dg_hdg.name			= "ehsd_ahrs_dg_hdg"
		ehsd_ahrs_dg_hdg.material		= mpcd_tpod_font
		ehsd_ahrs_dg_hdg.init_pos		= { -0.165,  0.87, 0}
		ehsd_ahrs_dg_hdg.alignment		= "CenterCenter"
		ehsd_ahrs_dg_hdg.formats		= {"%s"}
		ehsd_ahrs_dg_hdg.stringdefs		= MPCD_large_font_size
		ehsd_ahrs_dg_hdg.controllers	= {{"EHSD_PB07_PB08_Data"}}
Add_MPCD_VIDEO_Element(ehsd_ahrs_dg_hdg)

-- Target Designation
local	dtgt_steering					= CreateElement "ceStringPoly"
		dtgt_steering.name				= "dtgt_steering"
		dtgt_steering.init_pos			= mpcd_btn_01_pos
Add_MPCD_VIDEO_Element(dtgt_steering)

local	dtgt_steering					= CreateElement "ceStringPoly"
		dtgt_steering.name				= "dtgt_steering_type"
		dtgt_steering.material			= mpcd_tpod_font
		dtgt_steering.init_pos			= {0.1, 0.0, 0.0}
		dtgt_steering.alignment			= "CenterCenter"
		dtgt_steering.formats			= {"%s"}
		dtgt_steering.stringdefs		= MPCD_default_font_size
		dtgt_steering.parent_element	= "dtgt_steering"
		dtgt_steering.controllers		= {{"EHSD_DTG_Steering_Type"}}
Add_MPCD_VIDEO_Element(dtgt_steering)

-- Data Blocks
dofile(mpcd_path.."NAV/EHSD_NAV_TACAN.lua")	-- TACAN Data Block
dofile(mpcd_path.."NAV/EHSD_NAV_WYPT.lua")	-- NAV Data Block
-- @TODO: JDAM Data Block
dofile(mpcd_path.."NAV/EHSD_AGM_JDAM.lua")	-- JDAM data

-- COURSE
local	nav_crs_label					= CreateElement "ceStringPoly"
		nav_crs_label.name				= "nav_crs_label"
		nav_crs_label.material			= mpcd_tpod_font
		nav_crs_label.init_pos			= { 0.70,  -0.60, 0}
		nav_crs_label.alignment			= "CenterCenter"
		nav_crs_label.value				= "CRS"
		nav_crs_label.stringdefs		= MPCD_large_font_size
Add_MPCD_VIDEO_Element(nav_crs_label)

local	nav_crs_value					= CreateElement "ceStringPoly"
		nav_crs_value.name				= "nav_crs_value"
		nav_crs_value.material			= mpcd_tpod_font
		nav_crs_value.init_pos			= { 0.70,  -0.70, 0}
		nav_crs_value.alignment			= "CenterCenter"
		nav_crs_value.formats			= {"%03d"}
		nav_crs_value.controllers		= {{"nav_sel_crs"}}
		nav_crs_value.stringdefs		= MPCD_large_font_size
Add_MPCD_VIDEO_Element(nav_crs_value)

local	nav_crs_delta					= CreateElement "ceStringPoly"
		nav_crs_delta.name				= "nav_crs_delta"
		nav_crs_delta.material			= mpcd_tpod_font
		nav_crs_delta.init_pos			= { 0.70, -0.80, 0}
		nav_crs_delta.alignment			= "CenterCenter"
		nav_crs_delta.formats			= {"%.1fNM"}
		nav_crs_delta.controllers		= {{"nav_crs_delta"}}
		nav_crs_delta.stringdefs		= MPCD_data2_font_size
Add_MPCD_VIDEO_Element(nav_crs_delta)

local	nav_crs_delta_Symb					= create_mpcd_textured_box( 54, 540, 88, 575)
		nav_crs_delta_Symb.name				= "nav_crs_delta_symbol"
		nav_crs_delta_Symb.init_pos			= {-0.15, 0, 0}
		nav_crs_delta_Symb.parent_element	= nav_crs_delta.name
Add_MPCD_VIDEO_Element(nav_crs_delta_Symb)


-- AIRCRAFT DATA
local	ac_gt_deg					= CreateElement "ceStringPoly"
		ac_gt_deg.name				= "ac_gt_deg"
		ac_gt_deg.material			= mpcd_tpod_font
		ac_gt_deg.init_pos			= { -0.10,  0.0, 0}
		ac_gt_deg.alignment			= "RightCenter"
		ac_gt_deg.formats			= {"%03d;"}
		ac_gt_deg.stringdefs		= MPCD_large_font_size
		ac_gt_deg.controllers		= {{"EHSD_Compass_Rose_Center", -0.05}, {"ac_grd_trk_value"}}
Add_MPCD_VIDEO_Element(ac_gt_deg)

local	ac_gs_kts					= CreateElement "ceStringPoly"
		ac_gs_kts.name				= "ac_gs_kts"
		ac_gs_kts.material			= mpcd_tpod_font
		ac_gs_kts.init_pos			= { 0.10,  0.0, 0}
		ac_gs_kts.alignment			= "LeftCenter"
		ac_gs_kts.formats			= {"%3dKTS"}
		ac_gs_kts.stringdefs		= MPCD_large_font_size
		ac_gs_kts.controllers		= {{"EHSD_Compass_Rose_Center", -0.05}, {"ac_grd_spd_value"}}
Add_MPCD_VIDEO_Element(ac_gs_kts)

-- DISPLAY
local	zoom_scl_label				= CreateElement "ceStringPoly"
		zoom_scl_label.name			= "zoom_scl_label"
		zoom_scl_label.material		= mpcd_tpod_font
		zoom_scl_label.init_pos		= { -0.70,  -0.60, 0}
		zoom_scl_label.alignment	= "CenterCenter"
		zoom_scl_label.value		= "SCL"
		zoom_scl_label.stringdefs	= MPCD_large_font_size
Add_MPCD_VIDEO_Element(zoom_scl_label)

local	zoom_scl_value				= CreateElement "ceStringPoly"
		zoom_scl_value.name			= "zoom_scl_value"
		zoom_scl_value.material		= mpcd_tpod_font
		zoom_scl_value.init_pos		= { -0.70,  -0.70, 0}
		zoom_scl_value.alignment	= "CenterCenter"
		zoom_scl_value.formats		= {"%d"}
		zoom_scl_value.controllers	= {{"ehsd_scale_value"}}
		zoom_scl_value.stringdefs	= MPCD_large_font_size
Add_MPCD_VIDEO_Element(zoom_scl_value)

local	zoom_enabled				= CreateElement "ceStringPoly"
		zoom_enabled.name			= "zoom_enabled"
		zoom_enabled.material		= mpcd_tpod_font
		zoom_enabled.init_pos		= { -0.60,  -0.65, 0}
		zoom_enabled.alignment		= "LeftCenter"
		zoom_enabled.value			= "Z"
		zoom_enabled.stringdefs		= MPCD_data2_font_size
		zoom_enabled.controllers	= {{"ehsd_zoom_enabled"}}
Add_MPCD_VIDEO_Element(zoom_enabled)

-- SYMBOLS
local	aircraft_symbol				= create_mpcd_textured_box( 177, 931, 233, 1007, nil, 957)
		aircraft_symbol.name		= "aircraft_symbol"
		aircraft_symbol.init_pos	= {0, 0, 0}
		aircraft_symbol.controllers	= {{"EHSD_Compass_Rose_Center", -0.05}, {"EHSD_AC_ICON"}}
Add_MPCD_VIDEO_Element(aircraft_symbol)

