Thread Tools Display Modes
05-11-16, 10:32 AM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Theorizing questions

I am writing a modular UI replacement UI. This will enable users to turn on/off any components they wish. The code is using Ace3 for module control, settings, etc.

What I'd like to do is also offer themes, that at a click of a button, sets fonts, textures, colours, and styles for any frames, both native Blizzard and my AddOn's modules such as unit frames, action bars, etc. Think RDX, but also applying the theme to Blizzard frames.

The base code is written, but I haven't started coding themes yet. They will be skinned through LibSharedMedia-3.0.

Here's the theorizing: if I create a public function to apply or remove themes, what args should I pass in, and in what format? A name string for the theme, but the rest as a table? If a table, would adding that data to an internal metatable in the main AddOn that doesn't error on missing data be a good idea?

Would a theme be best created as a module and plugged into the module framework? Or is the function idea more workable?

I'm trying to think of the easiest, most effiecent method, that would apply the theme rapidly, and have the lowest impact on CPU and memory.

Thoughts or suggestions? I have looked at RDX's code, but I am trying for a fresh, clean, new approach. And that I don't want to just copy Sigg's work.
  Reply With Quote
05-11-16, 11:27 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
If you make them use a common folder starting name like myrroddinUI_xxx makes it easier to detect and list them. You can have the skin addon overwrite your settings function to replace the configuration table like:
Code:
function FauxMazzleUI:SetSkin(load)
	FauxMazzleUI.Skin = {
		left = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom1",
		centreleft = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom2",
		right = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom4",
		centreright = "Interface\\AddOns\\FauxMazzle_Skin_Default\\Bottom3",
		cave = "Interface\\AddOns\\FauxMazzle_Skin_Default\\FloatingCave",
		minimap = "Interface\\AddOns\\FauxMazzle_Skin_Default\\MinimapBorder",
	}
	return "The default skin", "Interface\\AddOns\\FauxMazzle_Skin_Default\\"
end
When the user selects a theme/skin, you load it (again) and do the setup with the newly overwritten config.
Code:
function NS:LoadSkin(settings, update)
	local skin = settings.skin
	if not skin or skin == "" then return end
	local addon = "FauxMazzle_Skin_"..skin -- from the common folder naming
	local loaded, reason = LoadAddOn(addon)
	if not loaded then
		print(NS.TEXTS.Error..": "..NS.TEXTS.ErrorLoadSkin.."(".._G["ADDON_".. reason].." - "..addon..")")
		skin = FMGLOBAL.DefaultSkin -- my default skin as backup
		loaded, reason = LoadAddOn(skin)
		 if not loaded then
			print(NS.TEXTS.Error..": "..NS.TEXTS.ErrorLoadSkin.."(".._G["ADDON_".. reason].." - "..addon..")")
			return 
		end
	end
	local name, path = FauxMazzleUI:SetSkin() -- Function created when loading the skin
	if not update then
		return name
	end
        -- replace all the textures.
	for i=1,4 do 
		NS.Frames["Main_"..i].Texture:SetTexture(path.."Bottom"..i)
	end
	NS.Frames.Minimap.Texture:SetTexture(path.."MinimapBorder")
	NS.Frames.Cave.Texture:SetTexture(path.."FloatingCave")
	print(NS.TEXTS.SkinLoaded..name)
	settings.skin = skin
end
One possibility.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-12-16 at 01:14 AM.
  Reply With Quote
05-11-16, 03:35 PM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Over the next few days I'll delve into MazzleUI to learn more. I like where you are going.

Since I see a default skin as a fallback, and my default skin would be no skin at all (unchanged Blizzard UI), should I retrieve and store Blizzard's colours, textures, shapes, etc and assign the values to my SV defaults table? Essentially creating an undo or unload of all skins?

Or would an unloading or AceAddOn disable call do pretty much the same thing?
  Reply With Quote
05-11-16, 03:38 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
I would think you would need to reset unless you are also doing a ReloadUI and the default is the... default.

I don't Ace so I'm not the best person to ask. Anyone?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Theorizing questions


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off