#include "ui/menudef.h"
#define LINE_ALPHA 0.2
#define FADEIN_TIME	125
#define ANGLES -3 -93
#define OPTION_COLOR		0 0 .1 1

#define EDITPRESET(SLOT_ID, PRESET_KEY, PRESET_TEXT, BELOW)\
	itemDef {	\
	name row##SLOT_ID	\
	text PRESET_TEXT	\
	textscale .225	\
	alignrect BELOW ITEM_ALIGN_LEFT 0 18 20 16	\
	textalign ITEM_ALIGN_LEFT	\
	textalignx 4	\
	textaligny 12	\
	forecolor OPTION_COLOR	\
	visible 1	\
	shortcutKey PRESET_KEY	\
	action { setfocus slot##SLOT_ID }	\
	decoration	\
	}	\
	itemDef {	\
	name slot##SLOT_ID	\
	alignrect row##SLOT_ID ITEM_ALIGN_LEFT 16 0 168 16	\
	style WINDOW_STYLE_EMPTY	\
	type ITEM_TYPE_EDITFIELD	\
	text ""	\
	cvar "ui_RQ3_radioPreset"#SLOT_ID"Desc"	\
	forecolor OPTION_COLOR	\
	maxPaintChars 17	\
	textscale .225	\
	textalign 0	\
	textalignx 4	\
	textaligny 12	\
	visible 1	\
	}	\
	itemDef {	\
	name "slot"#SLOT_ID"_dots"	\
	style 0	\
	text ".............................................."	\
	alignrect slot##SLOT_ID ITEM_ALIGN_LEFT 168 2 184 16	\
	textscale .225	\
	textalign ITEM_ALIGN_RIGHT	\
	textalignx 0	\
	textaligny 16	\
	forecolor OPTION_COLOR	\
	visible 1	\
	decoration	\
	}	\
	itemDef {	\
	style 0	\
	text ".............................................."	\
	alignrect "slot"#SLOT_ID"_dots" ITEM_ALIGN_RIGHT -184 0 184 16	\
	textscale .225	\
	textalign ITEM_ALIGN_RIGHT	\
	textalignx 0	\
	textaligny 16	\
	forecolor OPTION_COLOR	\
	visible 1	\
	decoration	\
	}	\
	itemDef {	\
	alignrect slot##SLOT_ID ITEM_ALIGN_LEFT 184 0 168 16	\
	style WINDOW_STYLE_EMPTY	\
	type ITEM_TYPE_EDITFIELD	\
	text ""	\
	cvar "ui_RQ3_radioPreset"#SLOT_ID"Script"	\
	forecolor OPTION_COLOR	\
	maxPaintChars 17	\
	textscale .225	\
	textalign 0	\
	textalignx 4	\
	textaligny 12	\
	visible 1	\
	}

{

	menuDef {
		name "ingame_presets_edit"
		visible 0
		fullscreen 0
		rect 144 80 436 280
		anglevectors ANGLES
		focusColor RQ3_MAIN_FOCUSCOLOR
		popup
		style WINDOW_STYLE_EMPTY
		onOpen {
			play "sound/ui/whoosh3.wav" ;
			setitemcolor window forecolor 5 5 5 0 ;
			timefade window forecolor 5 5 5 1 0 FADEIN_TIME
		}
		onESC { play "sound/ui/whoosh3.wav" ; close _self ; close ingame_presets }
		onOOBClick { play "sound/ui/whoosh3.wav" ; close _self ; open _prev }


		itemDef {
			name "paper"
			menuAnchor
			subgroup "fade_fore_alpha"
			style WINDOW_STYLE_SHADER
			background UI_ASSETS"/paper_1"
			forecolor MENUCOLOR_OPTIONS 1
			rect -8 -16 480 336
			anglevectors ANGLES
			visible 1
			decoration
		}

		//Title

		itemdef {
			renderpoint
			name "title"
			subgroup "fade_fore_alpha"
			text "Edit radio presets:"
			forecolor .6 .0 .0 1
			style WINDOW_STYLE_EMPTY
			textalign ITEM_ALIGN_LEFT
			textalignx 0
			textaligny 12
			textscale RQ3_MAIN_TEXTSIZE
			alignrect paper ITEM_ALIGN_LEFT 36 36 240 36 
			visible 1
			autowrapped
			decoration
		}

		itemDef {
			name "caption"
			text "Caption"
			textscale .225
			alignrect "title" ITEM_ALIGN_LEFT 0 18 56 16
			textalign ITEM_ALIGN_LEFT
			textalignx 20
			textaligny 12
			forecolor .25 .25 .25 1
			visible 1
			decoration
		}

		itemDef {
			name "script"
			text "Script"
			textscale .225
			alignrect "caption" ITEM_ALIGN_LEFT 200 0 48 16
			textalign ITEM_ALIGN_LEFT
			textalignx 4
			textaligny 12
			forecolor .25 .25 .25 1
			visible 1
			decoration
		}

		// order by: preset number, shortcut key, description, previous element
		EDITPRESET(1, "1", "^_1^_.", "caption")
		EDITPRESET(2, "2", "^_2^_.", "row1")
		EDITPRESET(3, "3", "^_3^_.", "row2")
		EDITPRESET(4, "4", "^_4^_.", "row3")
		EDITPRESET(5, "5", "^_5^_.", "row4")
		EDITPRESET(6, "6", "^_6^_.", "row5")
		EDITPRESET(7, "7", "^_7^_.", "row6")
		EDITPRESET(8, "8", "^_8^_.", "row7")
		EDITPRESET(9, "9", "^_9^_.", "row8")
		EDITPRESET(10, "0", "^_0^_.", "row9")
	}
}
