Quantcast

Added World Markers with keybinding options in Key Bindings menu

Repooc [03-25-13 - 10:10]
Added World Markers with keybinding options in Key Bindings menu
Filename
ElvUI_SLE/Bindings.xml
ElvUI_SLE/ElvUI_SLE.toc
ElvUI_SLE/config/profile.lua
ElvUI_SLE/modules/marks/flares.lua
ElvUI_SLE/modules/marks/load_marks.xml
ElvUI_SLE/modules/marks/options.lua
diff --git a/ElvUI_SLE/Bindings.xml b/ElvUI_SLE/Bindings.xml
new file mode 100644
index 0000000..f37f5e3
--- /dev/null
+++ b/ElvUI_SLE/Bindings.xml
@@ -0,0 +1,17 @@
+<Bindings>
+	<Binding name="CLICK SquareFlareMarker:LeftButton" header="SHADOWLIGHT_WORLDMARKER">
+		-- Square
+	</Binding>
+	<Binding name="CLICK TriangleFlareMarker:LeftButton">
+		-- Triangle
+	</Binding>
+	<Binding name="CLICK DiamondFlareMarker:LeftButton">
+		-- Diamond
+	</Binding>
+	<Binding name="CLICK CrossFlareMarker:LeftButton">
+		-- Cross
+	</Binding>
+	<Binding name="CLICK StarFlareMarker:LeftButton">
+		-- Star
+	</Binding>
+</Bindings>
\ No newline at end of file
diff --git a/ElvUI_SLE/ElvUI_SLE.toc b/ElvUI_SLE/ElvUI_SLE.toc
index 0b4e48a..1f70a76 100755
--- a/ElvUI_SLE/ElvUI_SLE.toc
+++ b/ElvUI_SLE/ElvUI_SLE.toc
@@ -3,7 +3,7 @@
 ## Author: Darth Predator, Repooc
 ## Version: 1.62
 ## Notes: Plugin-edit for |cff1784d1ElvUI|r.
-## Notes-ruRU: Плагин-редакция для |cff1784d1ElvUI|r.
+## Notes-ruRU: Плагин-редакци? дл? |cff1784d1ElvUI|r.
 ## eMail: darthpred@gmail.com, repooc@tukui.org
 ## URL: http://tukui.org/
 ## RequiredDeps: ElvUI
@@ -20,4 +20,5 @@ modules\load_modules.xml
 skins\load_skins.xml
 config\load_config.xml
 layout\layout.lua
-dev\load_dev.xml
\ No newline at end of file
+dev\load_dev.xml
+Bindings.xml
\ No newline at end of file
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index 1c40d81..18aca2e 100755
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -204,6 +204,13 @@ P['sle'] = {
 		['size'] = 18,
 	},

+	['flares'] = {
+		['enabled'] = true,
+		['growth'] = "RIGHT",
+		['showinside'] = false,
+		['size'] = 20,
+	},
+
 	--UI Buttons
 	['uibuttons'] = {
 		['enable'] = false,
diff --git a/ElvUI_SLE/modules/marks/flares.lua b/ElvUI_SLE/modules/marks/flares.lua
new file mode 100644
index 0000000..8515371
--- /dev/null
+++ b/ElvUI_SLE/modules/marks/flares.lua
@@ -0,0 +1,139 @@
+local E, L, V, P, G, _ = unpack(ElvUI);
+local RF = E:NewModule('RaidFlares', 'AceHook-3.0', 'AceEvent-3.0');
+
+BINDING_HEADER_SHADOWLIGHT_WORLDMARKER = GetAddOnMetadata(..., "Title");
+--BINDING_HEADER_SHADOWLIGHT_WORLDMARKER = string.format("|cffe1a500w|cff69ccf0Marker|r - %s",L["World markers"]);
+_G["BINDING_NAME_CLICK SquareFlareMarker:LeftButton"] = L["Square"];
+_G["BINDING_NAME_CLICK TriangleFlareMarker:LeftButton"] = L["Triangle"];
+_G["BINDING_NAME_CLICK DiamondFlareMarker:LeftButton"] = L["Diamond"];
+_G["BINDING_NAME_CLICK CrossFlareMarker:LeftButton"] = L["Cross"];
+_G["BINDING_NAME_CLICK StarFlareMarker:LeftButton"] = L["Star"];
+
+local mainFlares = CreateFrame("Frame", "Main_Flares", E.UIParent)
+local f1 = CreateFrame("Button", "SquareFlareMarker", Main_Flares, "SecureActionButtonTemplate")
+local f2 = CreateFrame("Button", "TriangleFlareMarker", Main_Flares, "SecureActionButtonTemplate")
+local f3 = CreateFrame("Button", "DiamondFlareMarker", Main_Flares, "SecureActionButtonTemplate")
+local f4 = CreateFrame("Button", "CrossFlareMarker", Main_Flares, "SecureActionButtonTemplate")
+local f5 = CreateFrame("Button", "StarFlareMarker", Main_Flares, "SecureActionButtonTemplate")
+
+local FlareB = {f1,f2,f3,f4,f5}
+
+function RF:CreateFrame()
+	mainFlares:Point("CENTER", E.UIParent, "CENTER", 0, 40);
+	mainFlares:SetFrameStrata('LOW');
+	mainFlares:CreateBackdrop();
+	mainFlares.backdrop:SetAllPoints();
+	mainFlares:Hide();
+end
+
+function RF:SetupButton(button, flare)
+	button:CreateBackdrop()
+	button.backdrop:SetAllPoints()
+	button:SetAttribute("type", "macro")
+	button:SetAttribute("macrotext",  '/wm '..flare..'')
+	button.tex = button:CreateTexture(nil, 'OVERLAY')
+	--button.tex:Point('TOPLEFT', button, 'TOPLEFT', 2, -2)
+	button.tex:Point('TOPLEFT', button, 'TOPLEFT', 0, -1)
+	--button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2)
+	button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 1)
+	if button == f1 then
+		button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_6")
+	elseif button == f2 then
+		button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_4")
+	elseif button == f3 then
+		button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_3")
+	elseif button == f4 then
+		button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_7")
+	elseif button == f5 then
+		button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_1")
+	end
+end
+
+function RF:CreateButtons()
+	for i = 1, 5 do
+		RF:SetupButton(FlareB[i], i)
+	end
+end
+
+function RF:FrameButtonsSize()
+	for i = 1, 5 do
+		FlareB[i]:Size(E.db.sle.flares.size)
+	end
+end
+
+function RF:FrameButtonsGrowth()
+	local db = E.db.sle.flares
+	local size = db.size
+	local width, height, x, y, anchor, point
+	local t = {5*size+8,size+4,"LEFT","RIGHT","TOP","BOTTOM",1,0,-1}
+	for i = 1, 5 do
+		FlareB[i]:ClearAllPoints()
+	end
+
+	if db.growth == "RIGHT" then
+		width, height, anchor, point, _, _, x, y = unpack(t)
+	elseif db.growth == "LEFT" then
+		width, height, point, anchor, _, _, _, y, x = unpack(t)
+	elseif db.growth == "UP" then
+		height, width, _, _, point, anchor, y, x = unpack(t)
+	elseif db.growth == "DOWN" then
+		height, width, _, _, anchor, point, _, x, y = unpack(t)
+	end
+
+	mainFlares:SetWidth(width)
+	mainFlares:SetHeight(height)
+
+	for i = 1, 5 do
+		if i == 1 then
+			FlareB[i]:Point(anchor, Main_Flares, anchor, 2 * x, 2 * y)
+		else
+			FlareB[i]:Point(anchor, FlareB[i-1], point, x, y)
+		end
+	end
+end
+
+function RF:UpdateVisibility()
+	local inInstance, instanceType = IsInInstance()
+	local db = E.db.sle.flares
+	if db.enabled then
+		if (inInstance and instanceType ~= "pvp") and db.showinside then
+			E.FrameLocks['Main_Flares'] = true
+			mainFlares:Show()
+		elseif not inInstance and db.showinside then
+			E.FrameLocks['Main_Flares'] = nil
+			mainFlares:Hide()
+		elseif not db.showinside then
+			E.FrameLocks['Main_Flares'] = true
+			mainFlares:Show()
+		end
+	else
+		E.FrameLocks['Main_Flares'] = true
+		mainFlares:Hide()
+	end
+end
+
+function RF:Backdrop()
+	if E.db.sle.flares.backdrop then
+		mainFlares.backdrop:Show()
+	else
+		mainFlares.backdrop:Hide()
+	end
+end
+
+function RF:Update()
+   RF:FrameButtonsSize()
+   RF:FrameButtonsGrowth()
+   RF:UpdateVisibility()
+   RF:Backdrop()
+end
+
+function RF:Initialize()
+   RF:CreateFrame()
+   RF:Update()
+   RF:CreateButtons()
+   self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisibility");
+
+   E:CreateMover(mainFlares, "FlareMover", "RF", nil, nil, nil, "ALL,S&L,S&L MISC")
+end
+
+E:RegisterModule(RF:GetName())
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/marks/load_marks.xml b/ElvUI_SLE/modules/marks/load_marks.xml
index cbcf6d9..248f4e3 100755
--- a/ElvUI_SLE/modules/marks/load_marks.xml
+++ b/ElvUI_SLE/modules/marks/load_marks.xml
@@ -1,4 +1,5 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='flares.lua'/>
 	<Script file='marks.lua'/>
 	<Script file='options.lua'/>
 </Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/marks/options.lua b/ElvUI_SLE/modules/marks/options.lua
index b067e60..c9719fa 100755
--- a/ElvUI_SLE/modules/marks/options.lua
+++ b/ElvUI_SLE/modules/marks/options.lua
@@ -1,5 +1,6 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
 local RM = E:GetModule('RaidMarks')
+local RF = E:GetModule('RaidFlares')
 local function configTable()

 --Main options group
@@ -78,6 +79,81 @@ E.Options.args.sle.args.marks = {
 		},
 	},
 }
+E.Options.args.sle.args.flares = {
+	order = 90,
+	type = "group",
+	name = L["Raid Flares"],
+	args = {
+		header = {
+			order = 1,
+			type = "header",
+			name = L["Raid Flares"],
+		},
+		enabled = {
+			order = 2,
+			type = "toggle",
+			name = L["Enable"],
+			desc = L["Show/Hide Raid Flares."],
+			get = function(info) return E.db.sle.flares.enabled end,
+			set = function(info, value) E.db.sle.flares.enabled = value; RF:UpdateVisibility() end
+		},
+		backdrop = {
+			order = 3,
+			type = "toggle",
+			name = L["Backdrop"],
+			disabled = function() return not E.db.sle.flares.enabled end,
+			get = function(info) return E.db.sle.flares.backdrop end,
+			set = function(info, value) E.db.sle.flares.backdrop = value; RF:Backdrop() end
+		},
+		--Reset = {
+			--order = 4,
+			--type = 'execute',
+			--name = L['Restore Defaults'],
+			--desc = L["Reset these options to defaults"],
+			--disabled = function() return not E.db.sle.flares.enabled end,
+			--func = function() E:GetModule('SLE'):Reset(nil, nil, nil, nil, true) end,
+		--},
+		spacer = {
+			order = 5,
+			type = 'description',
+			name = "",
+		},
+		showinside = {
+			order = 6,
+			type = "toggle",
+			name = L["Show only in instances"],
+			desc = L["Selecting this option will have the Raid Flares appear only while in a raid or dungeon."],
+			disabled = function() return not E.db.sle.flares.enabled end,
+			get = function(info) return E.db.sle.flares.showinside end,
+			set = function(info, value) E.db.sle.flares.showinside = value; RF:UpdateVisibility() end
+		},
+		size = {
+			order = 7,
+			type = "range",
+			name = L['Size'],
+			desc = L["Sets size of buttons"],
+			disabled = function() return not E.db.sle.flares.enabled end,
+			min = 15, max = 30, step = 1,
+			get = function(info) return E.db.sle.flares.size end,
+			set = function(info, value) E.db.sle.flares.size = value; RF:FrameButtonsGrowth(); RF:FrameButtonsSize() end,
+		},
+		growth = {
+			order = 8,
+			type = "select",
+			name = L["Direction"],
+			desc = L["Change the direction of buttons growth from the square marker"],
+			disabled = function() return not E.db.sle.flares.enabled end,
+			get = function(info) return E.db.sle.flares.growth end,
+			set = function(info, value) E.db.sle.flares.growth = value; RF:FrameButtonsGrowth() end,
+			values = {
+				['RIGHT'] = L["Right"],
+				['LEFT'] = L["Left"],
+				['UP'] = L["Up"],
+				['DOWN'] = L["Down"],
+			},
+		},
+	},
+}
 end

 table.insert(E.SLEConfigs, configTable)
\ No newline at end of file