Even if it's not "official", it's a really interesting idea. That would allow a whole bunch of new broker plugins.
Exactly! But it requires some(many) adjustements to make the display compatible. The amount of adjustments depends of the current display implementations as none have been designed to support these from start.
For exemple: if you allow plugins to resize in combat and that resize action tries to move adjacent plugins, it will taint if not done in a secure way. But a (simple ?) solution could be to lock them in combat.
I really hope new displays will be designed with secure stuff in mind. That would be the best to add in-combat features more freely without breaking.
Anyway, if you love programming, it's a great experience I recommend :p
I think the implementation could be done easily. For exemple you would change
local newBlock = _G.CreateFrame("Button", "StatBlockCore_"..name, UIParent)
local newBlock = _G.CreateFrame("Button", "StatBlockCore_"..name, UIParent, obj.secureTemplate)
That way, only plugins that use the "secureTemplate" field will see their button secure; other buttons will remain standard.
Also, add the following line after you finish your part of the initialization:
if obj.OnCreate then obj.OnCreate(obj, newBlock) end
That way, the plugin would be able to initialize the button actions (attributes) before the player can interact.
EDIT: removed code for OnDrag* as there's no need for it. Still, I think it would be better to declare your functions outside so you don't create closures for each block (except mousewheel which use local values). I modified your code and it works well, netting some memory.
Only taint I got was from mousewheel on secure buttons in combat (not a big deal), everything else is fine.
More display may want to allow secure buttons and I think we should standardize the field names and extend the LDB spec (It's been probably made extensible just to support secure stuff !! ;) :rolleyes:).
I have a small request to make your display more compatible with LDB addons that use secure button overlay for extended capabilities.
When the secure button is dragged, I call the underlying OnDragStart/OnDragStop and it works great with other displays. The problem with SBC is your scripts that don't allow parameters, as you call the environment-dependent "this".
If you're talking about a global width option, then no I don't think this would be too useful considering the amount of blocks that have various widths, I very much doubt you would want them all the same width.
I mean a "static" state as opposed to a "dynamic" one, not an unique width for all blocks. So when I choose global "static", each block would revert to their own fixed width, be it 100px for one and 130px for another. (The static width could also possibly be what each block had before switching from dynamic to static).
Quote from Funkydude »
I don't see how the scale really relates to font, you could have a small font yet a large scale.
Changing the scale keeps the same iconSize/fontSize ratio, whereas only changing the font size breaks it. Anyway my concrete probleme is my icons being too huge for the text. It's not coherent to have "global font size" but no "global icon size" and/or "global scale". (Did I missed some other global config too ? I use build 78649)
NB: Dammit, it seems my english hasnt improved at all :P
Being able to change the width of each block is nice (and CPU friendly). My main concern is about the alignement: the text seems to be centered with no option to change that. It results in chaotic alignements when the text width change from long to short and vice-versa. Please add an option to change the default alignement (left, center, right).
Still having the possibility to choose between static and dynamic width (with fine grained / master level of control, just like you did with other options so far <3) would be great.
In the config panel, plugins aren't sorted by names, it's not practical when configuring a lot of plugins :P
The global font option allow to adjust the ratio "icon size" / "text size". But to reduce/increase the scale of the whole we have to go block by block, it's tedious :P.