local v do v={}local U=1 local L=U local function C(C,I,G,y,n)local k=false local l=Create(Icon("\073\109\097\103\101\066\117\116\116\111\110",C),{Name=G.."\066\117\116\116\111\110";Visible=Option.Modifiable and Option.Selectable;Position=UDim2.new(1,-(GUI_SIZE+2)*L+2,.25,-GUI_SIZE/2),Size=UDim2.new(0,GUI_SIZE,0,GUI_SIZE);Parent=headerFrame})local e=Create("\084\101\120\116\076\097\098\101\108",{Name=G.."\084\101\120\116",Text=G;Visible=false,BackgroundTransparency=1,TextXAlignment="\082\105\103\104\116",Font=FONT,FontSize=FONT_SIZE;Position=UDim2.new(0,0,0,0),Size=UDim2.new(1,-(GUI_SIZE+2)*U,1,0),Parent=headerFrame})l.MouseEnter:connect(function()if k then l.BackgroundTransparency=.9 end end)l.MouseLeave:connect(function()l.BackgroundTransparency=1 end)L=L+1 v[#v+1]={Obj=l,Cond=n}QuickButtons[#v+1]={Obj=l;Cond=n;Toggle=function(v)if v then k=true Icon(l,I)else k=false Icon(l,C)end end}return l end local function I(v)v.Parent=nil end;(C(ACTION_EDITQUICKACCESS,ACTION_EDITQUICKACCESS,"\079\112\116\105\111\110\115",true,function()return true end)).MouseButton1Click:connect(function() end);(C(ACTION_DELETE,ACTION_DELETE_OVER,"\068\101\108\101\116\101",true,function()return#Selection:Get()>0 end)).MouseButton1Click:connect(function()if not Option.Modifiable then return end local v=Selection:Get()for U=1,#v,1 do pcall(I,v[U])end Selection:Set({})end);(C(ACTION_PASTE,ACTION_PASTE_OVER,"\080\097\115\116\101",true,function()return#Selection:Get()>0 and#clipboard>0 end)).MouseButton1Click:connect(function()if not Option.Modifiable then return end local v=Selection.List[1]or workspace for U=1,#clipboard,1 do(clipboard[U]:Clone()).Parent=v end end);(C(ACTION_COPY,ACTION_COPY_OVER,"\067\111\112\121",true,function()return#Selection:Get()>0 end)).MouseButton1Click:connect(function()if not Option.Modifiable then return end clipboard={}local v=Selection.List for U=1,#v,1 do table.insert(clipboard,v[U]:Clone())end updateActions()end);(C(ACTION_CUT,ACTION_CUT_OVER,"\067\117\116",true,function()return#Selection:Get()>0 end)).MouseButton1Click:connect(function()if not Option.Modifiable then return end clipboard={}local v=Selection.List local U={}for L=1,#v,1 do local C=v[L]:Clone()if C then table.insert(clipboard,C)table.insert(U,v[L])end end for v=1,#U,1 do pcall(I,U[v])end updateActions()end)C(ACTION_FREEZE,ACTION_FREEZE,"\070\114\101\101\122\101",true,function()return true end)C(ACTION_ADDSTAR,ACTION_ADDSTAR_OVER,"\083\116\097\114",true,function()return#Selection:Get()>0 end)C(ACTION_STARRED,ACTION_STARRED,"\083\116\097\114\114\101\100",true,function()return true end)end
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- Actions

local actionButtons
do
	actionButtons = {}

	local totalActions = 1
	local currentActions = totalActions
	local function makeButton(icon, over, name, vis, cond)
		local buttonEnabled = false

		local button = Create(Icon("ImageButton", icon), {
			Name = name .. "Button",
			Visible = Option.Modifiable and Option.Selectable,
			Position = UDim2.new(1, -(GUI_SIZE + 2) * currentActions + 2, 0.25, -GUI_SIZE / 2),
			Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE),
			Parent = headerFrame,
		})

		local tipText = Create("TextLabel", {
			Name = name .. "Text",
			Text = name,
			Visible = false,
			BackgroundTransparency = 1,
			TextXAlignment = "Right",
			Font = FONT,
			FontSize = FONT_SIZE,
			Position = UDim2.new(0, 0, 0, 0),
			Size = UDim2.new(1, -(GUI_SIZE + 2) * totalActions, 1, 0),
			Parent = headerFrame,
		})

		button.MouseEnter:connect(function()
			if buttonEnabled then
				button.BackgroundTransparency = 0.9
			end
			--Icon(button,over)
			--tipText.Visible = true
		end)
		button.MouseLeave:connect(function()
			button.BackgroundTransparency = 1
			--Icon(button,icon)
			--tipText.Visible = false
		end)

		currentActions = currentActions + 1
		actionButtons[#actionButtons + 1] = { Obj = button, Cond = cond }
		QuickButtons[#actionButtons + 1] = {
			Obj = button,
			Cond = cond,
			Toggle = function(on)
				if on then
					buttonEnabled = true
					Icon(button, over)
				else
					buttonEnabled = false
					Icon(button, icon)
				end
			end,
		}
		return button
	end

	--local clipboard = {}
	local function delete(o)
		o.Parent = nil
	end

	makeButton(ACTION_EDITQUICKACCESS, ACTION_EDITQUICKACCESS, "Options", true, function()
		return true
	end).MouseButton1Click:connect(function() end)

	-- DELETE
	makeButton(ACTION_DELETE, ACTION_DELETE_OVER, "Delete", true, function()
		return #Selection:Get() > 0
	end).MouseButton1Click:connect(function()
		if not Option.Modifiable then
			return
		end
		local list = Selection:Get()
		for i = 1, #list do
			pcall(delete, list[i])
		end
		Selection:Set({})
	end)

	-- PASTE
	makeButton(ACTION_PASTE, ACTION_PASTE_OVER, "Paste", true, function()
		return #Selection:Get() > 0 and #clipboard > 0
	end).MouseButton1Click:connect(function()
		if not Option.Modifiable then
			return
		end
		local parent = Selection.List[1] or workspace
		for i = 1, #clipboard do
			clipboard[i]:Clone().Parent = parent
		end
	end)

	-- COPY
	makeButton(ACTION_COPY, ACTION_COPY_OVER, "Copy", true, function()
		return #Selection:Get() > 0
	end).MouseButton1Click:connect(function()
		if not Option.Modifiable then
			return
		end
		clipboard = {}
		local list = Selection.List
		for i = 1, #list do
			table.insert(clipboard, list[i]:Clone())
		end
		updateActions()
	end)

	-- CUT
	makeButton(ACTION_CUT, ACTION_CUT_OVER, "Cut", true, function()
		return #Selection:Get() > 0
	end).MouseButton1Click:connect(function()
		if not Option.Modifiable then
			return
		end
		clipboard = {}
		local list = Selection.List
		local cut = {}
		for i = 1, #list do
			local obj = list[i]:Clone()
			if obj then
				table.insert(clipboard, obj)
				table.insert(cut, list[i])
			end
		end
		for i = 1, #cut do
			pcall(delete, cut[i])
		end
		updateActions()
	end)

	-- FREEZE
	makeButton(ACTION_FREEZE, ACTION_FREEZE, "Freeze", true, function()
		return true
	end)

	-- ADD/REMOVE STARRED
	makeButton(ACTION_ADDSTAR, ACTION_ADDSTAR_OVER, "Star", true, function()
		return #Selection:Get() > 0
	end)

	-- STARRED
	makeButton(ACTION_STARRED, ACTION_STARRED, "Starred", true, function()
		return true
	end)

	-- SORT
	-- local actionSort = makeButton(ACTION_SORT,ACTION_SORT_OVER,"Sort")
end
