-- K-MeleonCCF Preference Dialog V0.01

require "dialog"
require "preferenceGUI\\locals"

-- Sized for the longer credits list. Original was 120x130 with an 80x80
-- static, which had already overflowed - bumped so the new text fits cleanly.
local a = create_dialog({
	width = 200,
	height = 180,
	caption = "About K-MeleonCCF",
	font="Arial",

	{
		type = "button",
		style = w32dlg.BS_DEFPUSHBUTTON,
		x = 80,
		y = 155,
		width = 40,
		height = 14,
		id = "IDBUTTON",
		caption = "OK"
	},

	{
		type = "static",
		x = 10,
		y = 10,
		width = 180,
		height = 140,
		id = "IDSTATIC1",
		caption = "About K-MeleonCCF\n\n Version 1.02 \n\n On Goanna 6 (UXP / Pale Moon engine) \n Lua 5.1 hot-reload scripting \n Built-in AI agent sidebar \n\n Author: Hao Jiang \n\t xvacant \n\t Dorian \n\t Guenter \n\t Mark307 \n\n        2026"
	},
})


function CCFDialog()
	local r, rr, t, k, v, m
	
	m = {"Gestures","Hotlinks","Bookmark","Favorites","Search Bar","URL Bar","Advanced"}
	
	r, rr = d("Preference", {
		IDLIST1 = {
			{1},  -- initial selection
			m,    -- items
		},
	})
	if r=="IDBUTTONNEXT" or r=="IDLIST1" then
		if table.concat(rr.IDLIST1, " ") == "1" then 
			gestrures_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "2" then 
			hotlink_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "3" then 
			bookmark_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "4" then 
			favorite_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "5" then 
			searchbar_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "6" then 
			urlbar_dialog()
			CCFDialog()
		elseif table.concat(rr.IDLIST1, " ") == "7" then 
			advanced_dialog()	
			CCFDialog()
		end
	elseif r=="IDBUTTONCANCEL" then
	end		
end

function AboutDialog()
	r, rr = a(_ABOUT)
end
