diff --git a/pMinimap_Config/pMinimap_Config.lua b/pMinimap_Config/pMinimap_Config.lua index cde0ee0..716f02d 100644 --- a/pMinimap_Config/pMinimap_Config.lua +++ b/pMinimap_Config/pMinimap_Config.lua @@ -1 +1 @@ -LibStub('LibSimpleOptions-1.0').AddOptionsPanel('pMinimap', function(self) local title, sub = self:MakeTitleTextAndSubText('pMinimap', 'These options allow you to customize the looks of pMinimap.') self:MakeToggle( 'name', 'Unlocked', 'description', '', 'default', false, 'current', pMinimapDB.unlocked, 'setFunc', function(value) pMinimapDB.unlocked = value if(value) then Minimap:SetBackdropColor(0, 1, 0, 0.5) else Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -16) self:MakeToggle( 'name', 'Clock', 'description', '', 'default', true, 'current', pMinimapDB.clock, 'setFunc', function(value) pMinimapDB.clock = value if(value) then if(not pMinimap.RunClock) then pMinimap:CreateClock() end TimeManagerClockButton:Show() TimeManagerClockButton:ClearAllPoints() TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap) else TimeManagerClockButton:Hide() end if(pMinimapDB.coords) then pMinimap.Coord:ClearAllPoints() pMinimap.Coord:SetPoint(value and 'BOTTOMRIGHT' or 'BOTTOM', Minimap) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -38) self:MakeToggle( 'name', 'Coordinates', 'description', '', 'default', false, 'current', pMinimapDB.coords, 'setFunc', function(value) pMinimapDB.coords = value if(value) then if(not pMinimap.RunCoords) then pMinimap:CreateCoords() end pMinimap.Coord:Show() pMinimap.Coord:ClearAllPoints() pMinimap.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap) else pMinimap.Coord:Hide() end if(pMinimapDB.clock) then TimeManagerClockButton:ClearAllPoints() TimeManagerClockButton:SetPoint(value and 'BOTTOMLEFT' or 'BOTTOM', Minimap) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -60) self:MakeToggle( 'name', 'ZoneText', 'description', '', 'default', false, 'current', pMinimapDB.zone, 'setFunc', function(value) pMinimapDB.zone = value if(value) then MinimapZoneTextButton:Show() else MinimapZoneTextButton:Hide() end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -82) self:MakeToggle( 'name', 'Mail', 'description', '', 'default', true, 'current', pMinimapDB.mail, 'setFunc', function(value) pMinimapDB.mail = value if(value) then MiniMapMailFrame:RegisterEvent('UPDATE_PENDING_MAIL') if(HasNewMail()) then MiniMapMailFrame:Show() end else MiniMapMailFrame:UnregisterEvent('UPDATE_PENDING_MAIL') MiniMapMailFrame:Hide() end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -104) self:MakeToggle( 'name', 'Durability', 'description', '', 'default', true, 'current', pMinimapDB.dura, 'setFunc', function(value) pMinimapDB.dura = value if(value) then DurabilityFrame:SetAlpha(0) pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS') pMinimap.UPDATE_INVENTORY_ALERTS() else DurabilityFrame:SetAlpha(1) pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS') Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -126) self:MakeSlider( 'name', 'Minimap Scale', 'description', '', 'default', 1, 'current', pMinimapDB.scale, 'minText', '0.75', 'maxText', '2.50', 'minValue', 0.75, 'maxValue', 2.50, 'step', 0.01, 'setFunc', function(value) pMinimapDB.scale = value Minimap:SetScale(value) end, 'currentTextFunc', function(num) return format('%.2f', num) end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 225, -26) self:MakeSlider( 'name', 'Backdrop Thickness', 'description', '', 'default', 1, 'current', pMinimapDB.offset, 'minText', '0', 'maxText', '10', 'minValue', 0, 'maxValue', 10, 'step', 0.5, 'setFunc', function(value) pMinimapDB.offset = value Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - value, left = - value, bottom = - value, right = - value}}) Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end, 'currentTextFunc', function(num) return format('%.1f', num) end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 225, -60) self:MakeSlider( 'name', 'Font Size', 'description', '', 'default', 13, 'current', pMinimapDB.fontsize, 'minText', '5', 'maxText', '18', 'minValue', 5, 'maxValue', 18, 'step', 1, 'setFunc', function(value) pMinimapDB.fontsize = value pMinimap.Mail:SetTextHeight(value) MinimapZoneText:SetTextHeight(value) if(pMinimapDB.clock) then TimeManagerClockTicker:SetTextHeight(value) end if(pMinimapDB.coords) then pMinimap.Coord.Text:SetTextHeight(value) end end, 'currentTextFunc', function(num) return num end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 225, -106) self:MakeSlider( 'name', 'Minimap FrameLevel', 'description', '', 'default', 2, 'current', pMinimapDB.level, 'minText', '1', 'maxText', '15', 'minValue', 1, 'maxValue', 15, 'step', 1, 'setFunc', function(value) pMinimapDB.level = value Minimap:SetFrameLevel(value) end, 'currentTextFunc', function(num) return num end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 225, -146) self:MakeSlider( 'name', 'ZoneText offset', 'description', '', 'default', 8, 'current', pMinimapDB.zoneOffset, 'minText', '-25', 'maxText', '25', 'minValue', -25, 'maxValue', 25, 'step', 0.5, 'setFunc', function(value) pMinimapDB.zoneOffset = value MinimapZoneTextButton:ClearAllPoints() MinimapZoneTextButton:SetPoint(pMinimapDB.zonePoint1, Minimap, pMinimapDB.zonePoint2, 0, value) end, 'currentTextFunc', function(num) return num end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 225, -186) self:MakeColorPicker( 'name', 'Backdrop Color', 'description', '', 'hasAlpha', true, 'defaultR', 0, 'defaultG', 0, 'defaultB', 0, 'defaultA', 1, 'getFunc', function() return unpack(pMinimapDB.colors) end, 'setFunc', function(r, g, b, a) pMinimapDB.colors = {r, g, b, a} Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -340) self:MakeDropDown( 'name', 'Frame Strata', 'description', '', -- better description 'values', {'DIALOG', 'Dialog', 'HIGH', 'High', 'MEDIUM', 'Medium', 'LOW', 'Low', 'BACKGROUND', 'Background'}, 'default', 'BACKGROUND', 'current', pMinimapDB.strata, 'setFunc', function(value) pMinimapDB.strata = value Minimap:SetFrameStrata(value) end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 140, -340) self:MakeDropDown( 'name', 'Font Flag', 'description', '', -- better description 'values', {'OUTLINE', 'Outline', 'THICKOUTLINE', 'Thick Outline', 'MONOCHROME', 'Monochrome', 'nil', 'None'}, 'default', 'OUTLINE', 'current', pMinimapDB.fontflag, 'setFunc', function(value) pMinimapDB.fontflag = value pMinimap.Mail:SetFont(pMinimapDB.font, pMinimapDB.fontsize, value) MinimapZoneText:SetFont(pMinimapDB.font, pMinimapDB.fontsize, value) if(pMinimapDB.clock) then TimeManagerClockTicker:SetFont(pMinimapDB.font, pMinimapDB.fontsize, value) end if(pMinimapDB.coords) then pMinimap.Coord.Text:SetFont(pMinimapDB.font, pMinimapDB.fontsize, value) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 265, -340) self:MakeDropDown( 'name', 'ZoneText Point', 'description', '', 'values', {'TOP', 'Top', 'BOTTOM', 'Bottom'}, 'default', 'TOP', 'current', pMinimapDB.zonePoint2, 'setFunc', function(value) pMinimapDB.zonePoint2 = value MinimapZoneTextButton:ClearAllPoints() if(value == 'TOP') then pMinimapDB.zonePoint1 = 'BOTTOM' MinimapZoneTextButton:SetPoint('BOTTOM', Minimap, value, 0, pMinimapDB.zoneOffset) else pMinimapDB.zonePoint1 = 'TOP' MinimapZoneTextButton:SetPoint('TOP', Minimap, value, 0, pMinimapDB.zoneOffset) end end ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 265, -270) end) \ No newline at end of file +local LSM = LibStub('LibSharedMedia-3.0') local list = LSM:List('font') local function AddToFontStrings() pMinimap.Mail:SetFont(LSM:Fetch('font', pMinimapDB.font), pMinimapDB.fontsize, pMinimapDB.fontflag) MinimapZoneText:SetFont(LSM:Fetch('font', pMinimapDB.font), pMinimapDB.fontsize, pMinimapDB.fontflag) if(pMinimapDB.clock) then TimeManagerClockTicker:SetFont(LSM:Fetch('font', pMinimapDB.font), pMinimapDB.fontsize, pMinimapDB.fontflag) end if(pMinimapDB.coords) then pMinimap.Coord.Text:SetFont(LSM:Fetch('font', pMinimapDB.font), pMinimapDB.fontsize, pMinimapDB.fontflag) end end LibStub('AceConfigDialog-3.0'):AddToBlizOptions('pMinimap', 'pMinimap') LibStub('AceConfig-3.0'):RegisterOptionsTable('pMinimap', { name = 'pMinimap Options', type = 'group', args = { lock = { type = 'toggle', order = 0, name = 'Unlocked', get = function() return pMinimapDB.unlocked end, set = function() pMinimapDB.unlocked = not pMinimapDB.unlocked if(pMinimapDB.unlocked) then Minimap:SetBackdropColor(0, 1, 0, 0.5) else Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end end }, clock = { type = 'toggle', order = 1, name = 'Clock', get = function() return pMinimapDB.clock end, set = function() pMinimapDB.clock = not pMinimapDB.clock if(pMinimapDB.clock) then if(not pMinimap.RunClock) then pMinimap:CreateClock() else TimeManagerClockButton:Show() TimeManagerClockButton:ClearAllPoints() TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap) end else TimeManagerClockButton:Hide() end if(pMinimapDB.coords) then pMinimap.Coord:ClearAllPoints() pMinimap.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap) end end }, coords = { type = 'toggle', order = 2, name = 'Coords', get = function() return pMinimapDB.coords end, set = function() pMinimapDB.coords = not pMinimapDB.coords if(pMinimapDB.coords) then if(not pMinimap.RunCoords) then pMinimap:CreateCoords() else pMinimap.Coord:Show() pMinimap.Coord:ClearAllPoints() pMinimap.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap) end else pMinimap.Coord:Hide() end if(pMinimapDB.clock) then TimeManagerClockButton:ClearAllPoints() TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap) end end }, zone = { type = 'toggle', order = 3, name = 'ZoneText', get = function() return pMinimapDB.zone end, set = function() pMinimapDB.zone = not pMinimapDB.zone if(pMinimapDB.zone) then MinimapZoneTextButton:Show() else MinimapZoneTextButton:Hide() end end }, mail = { type = 'toggle', order = 4, name = 'Mail', get = function() return pMinimapDB.mail end, set = function() pMinimapDB.mail = not pMinimapDB.mail if(pMinimapDB.mail) then MiniMapMailFrame:RegisterEvent('UPDATE_PENDING_MAIL') if(HasNewMail()) then MiniMapMailFrame:Show() end else MiniMapMailFrame:UnregisterEvent('UPDATE_PENDING_MAIL') MiniMapMailFrame:Hide() end end }, dura = { type = 'toggle', order = 5, name = 'Durability', get = function() return pMinimapDB.dura end, set = function() pMinimapDB.dura = not pMinimapDB.dura if(pMinimapDB.dura) then DurabilityFrame:SetAlpha(0) pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS') pMinimap.UPDATE_INVENTORY_ALERTS() else DurabilityFrame:SetAlpha(1) pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS') Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end end }, scale = { type = 'range', order = 6, name = 'Minimap Scale', min = 0.75, max = 2.50, step = 0.01, get = function() return pMinimapDB.scale end, set = function(_, value) pMinimapDB.scale = value Minimap:SetScale(value) end, }, bgthick = { type = 'range', order = 7, name = 'Backdrop Thickness', min = 0, max = 10, step = 0.5, get = function() return pMinimapDB.offset end, set = function(_, value) pMinimapDB.offset = value Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - value, left = - value, bottom = - value, right = - value}}) Minimap:SetBackdropColor(unpack(pMinimapDB.colors)) end }, fontsize = { type = 'range', order = 8, name = 'Font Size', min = 5, max = 18, step = 1, get = function() return pMinimapDB.fontsize end, set = function(_, value) pMinimapDB.fontsize = value AddToFontStrings() end }, level = { type = 'range', order = 9, name = 'Frame level', min = 1, max = 15, step = 1, get = function() return pMinimapDB.level end, set = function(_, value) pMinimapDB.level = value Minimap:SetFrameLevel(value) end }, zoneoffset = { type = 'range', order = 10, name = 'ZoneText offset', min = -25, max = 25, step = 0.5, get = function() return pMinimapDB.zoneOffset end, set = function(_, value) pMinimapDB.zoneOffset = value MinimapZoneTextButton:ClearAllPoints() MinimapZoneTextButton:SetPoint(pMinimapDB.zonePoint1, Minimap, pMinimapDB.zonePoint2, 0, value) end }, bgcolor = { type = 'color', order = 11, name = 'Backdrop Color', hasAlpha = true, get = function() return unpack(pMinimapDB.colors) end, set = function(_, r, g, b, a) pMinimapDB.colors = {r, g, b, a} Minimap:SetBackdropColor(r, g, b, a) end }, strata = { type = 'select', order = 12, name = 'Frame Strata', values = {['DIALOG'] = 'DIALOG', ['HIGH'] = 'HIGH', ['MEDIUM'] = 'MEDIUM', ['LOW'] = 'LOW', ['BACKGROUND'] = 'BACKGROUND'}, get = function() return pMinimapDB.strata end, set = function(_, strata) pMinimapDB.strata = strata Minimap:SetFrameStrata(strata) end }, zonepoint = { type = 'select', order = 13, name = 'ZoneText point', values = {['TOP'] = 'TOP', ['BOTTOM'] = 'BOTTOM'}, get = function() return pMinimapDB.zonePoint2 end, set = function(_, point) print(point) pMinimapDB.zonePoint2 = point if(point == 'TOP') then pMinimapDB.zonePoint1 = 'BOTTOM' MinimapZoneTextButton:ClearAllPoints() MinimapZoneTextButton:SetPoint('BOTTOM', Minimap, point, 0, pMinimapDB.zoneOffset) else pMinimapDB.zonePoint1 = 'TOP' MinimapZoneTextButton:ClearAllPoints() MinimapZoneTextButton:SetPoint('TOP', Minimap, point, 0, pMinimapDB.zoneOffset) end end }, font = { type = 'select', order = 14, name = 'Font', values = list, get = function() for k, v in next, list do if(v == pMinimapDB.font) then return k end end end, set = function(_, font) pMinimapDB.font = list[font] AddToFontStrings() end } } }) \ No newline at end of file diff --git a/pMinimap_Config/pMinimap_Config.toc b/pMinimap_Config/pMinimap_Config.toc index fb29d10..c4f5776 100644 --- a/pMinimap_Config/pMinimap_Config.toc +++ b/pMinimap_Config/pMinimap_Config.toc @@ -6,7 +6,8 @@ ## RequiredDeps: pMinimap ## LoadOnDemand: 1 -LibSimpleOptions\LibStub\LibStub.lua -LibSimpleOptions\LibSimpleOptions-1.0.lua +libs\LibStub\LibStub.lua +libs\AceGUI-3.0\AceGUI-3.0.xml +libs\AceConfig-3.0\AceConfig-3.0.xml pMinimap_Config.lua \ No newline at end of file