Download
(902 b)
Download
Updated: 06/11/14 10:29 AM
Compatibility:
Craglorn (1.1)
Updated:06/11/14 10:29 AM
Created:06/11/14 10:29 AM
Monthly downloads:89
Total downloads:37,123
Favorites:17
MD5:
LibAddonMenu 1.0 to 2.0 Interface  Popular! (More than 5000 hits)
Version: 1
by: Sasky [More]
Disclaimers

If you use this, please check to make sure any addon menu bugs are not with the interface before submitting to Seerah. If in doubt, submit the bug here first, and I can help verify.

This is for addon authors only. It does not convert the settings menu from 1.0 to 2.0 for end users. As such, I have not included a manifest/txt file, so the game will not detect this if downloaded directly.

I do not make any claim to own the LAM code. I have obtained permission to upload an interface, but the original rights for code and API are reserved by Seerah.

Overview
This enables authors with simple usage of LibAddonMenu-1.0 to quickly start using LibAddonMenu-2.0.

This does not convert your code, just provides a simple adapter to keep using your LAM-1.0 coding with LAM-2.0

As well, this allows you to use a function-based interface rather than constructing and passing in the table yourself.

Requirements
Not all addons that use LAM-1.0 can be converted using an interface. In particular, if you do any of the following, you will just have to keep using 1.0 or rewrite to convert to 2.0:
  • NOT use code to adjust the settings panel directly
  • NOT use the values returned from the LAM functions for anything other than passing into other LAM functions
  • NOT adjust properties of LAM directly

These situations are impossible (or close enough) to code an adapter for. As well, LAM2 provides better customization for advanced usage.

Usage

Warning: With 1.4 release, ZOS has a reduced path length limit (See here for details). This library by default has a rather long name and can easily exceed that if nested deeply.
  1. Remove the LibAddonMenu-1.0.lua file and any references to it from the manifest (.txt) file.
  2. Download LibStub and follow the instructions there to set it up
  3. Follow the instructions in LAM-2.0 and set it as if you were using the 2.0 version.
  4. Download this addon and add the interface file to your addon. Make sure to include an entry in the manifest (.txt) file after any LAM entries.
  5. Change the following one line where you declare LAM for usage from
    Code:
    local LAM = LibStub("LibAddonMenu-1.0")
    to
    Code:
    local LAM = LibStub("LibAddonMenu-1.0-to-2.0")

If you meet all the requirements, that's it!
Currently, this is just intended for upgrading, and does not contain any of the new functionality (textures, custom panels).
Post A Reply Comment Options
Unread 11/05/14, 02:36 PM  
Wetnose

Forum posts: 0
File comments: 1
Uploads: 0
Cool GuildTools

I have a feeling this will resolve the issues I'm currently experiencing with GuildTools after Update 5. I'm not the developer, but I noticed after looking at the Add on that it uses LibAddonMenu 1.0. I'll try this later tonight to see if it works.
Report comment to moderator  
Reply With Quote
Unread 11/04/14, 03:45 PM  
Sasky
AddOn Author - Click to view AddOns

Forum posts: 231
File comments: 87
Uploads: 4
Yeah, Garkin and I actually looked at that awhile back. It works with most addons, as they just use the LAM API and don't mess with the returned objects/panels. When first implemented, that was probably around 80-90% of addons (and is probably much higher now). See this thread for where we got and code. Looking back, the abrupt ending to it was probably because of 1.3 and never got back to it. You're welcome to use that code if you want something (potentially) a bit more robust.
Report comment to moderator  
Reply With Quote
Unread 11/04/14, 12:51 PM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 671
File comments: 213
Uploads: 12
This one is more awesome than you admit, Sasky I've just put your interface in a separate fake addon, changed it so that it pretends to be LibAddonMenu-1.0 version 99, and add-ons with LAM1 that were spitting errors now simply work - namely BugEater, CraftingMaterialLevelDisplay, MitigationValue. Thanks.
Report comment to moderator  
Reply With Quote
Unread 09/17/14, 11:20 AM  
Sasky
AddOn Author - Click to view AddOns

Forum posts: 231
File comments: 87
Uploads: 4
Originally Posted by QuadroTony
Minion wont display this addon in "Find More" by search or in category....
As noted on first page: This is for addon authors only. It does not convert the settings menu from 1.0 to 2.0 for end users.

So it's probably a good thing it doesn't show up in Minion to avoid confusion.
Report comment to moderator  
Reply With Quote
Unread 09/17/14, 11:15 AM  
QuadroTony
Banned
 
QuadroTony's Avatar
AddOn Author - Click to view AddOns

Forum posts: 828
File comments: 3866
Uploads: 3
Minion wont display this addon in "Find More" by search or in category....
Last edited by QuadroTony : 09/17/14 at 11:15 AM.
Report comment to moderator  
Reply With Quote
Unread 06/19/14, 02:05 AM  
Sasky
AddOn Author - Click to view AddOns

Forum posts: 231
File comments: 87
Uploads: 4
Originally Posted by zgrssd
As I understand it, it takes your existing LAM 1.0 function calls and makes a LAM 2.0 table for you from that.
It then hands the automagically crafted table to LAM 2.0 for display.
So you don't have to rewrite more then 1-2 lines of your addon while still having the new LAM 2.0 look and bugfxies (like re-using elements to avoid 'too many anchors' problem). I was actually hoping for something like this to be part of the LAM 2.0 API, but this works too.

I could really use this as I only use simplest case menu's so far, but will propably learn LAM 2.0 in the long run. Table based approaches are closer to XML and XAML, so I think it is better in the long run.
Exactly what I was going for on releasing this. Quickly start using LAM2 now, can change to the proper format in the future (if desired). I'm actually making up an object-oriented interface that will be closer to LAM1-style and include some of the missing features (textures, custom panel, call-on-create, etc).

For ordering, you want dependencies first like you listed. The Lua files are processed in-order.
Report comment to moderator  
Reply With Quote
Unread 06/18/14, 04:34 AM  
zgrssd
AddOn Author - Click to view AddOns

Forum posts: 280
File comments: 26
Uploads: 3
I can't test it right now, but is that the proper way to order your .lua files in your manifest?
Code:
--first libStub, for LAM, the covnerter and every other embedded library that use it
libs\Stub.lua

--other libStub dependant stuff that does not need LAM

--usual LAM 2.0 stuff, as shown on the LAM 2.0 page
libs\LibAddonMenu-2.0\LibAddonMenu-2.0.lua
libs\LibAddonMenu-2.0\controls\panel.lua
libs\LibAddonMenu-2.0\controls\submenu.lua
libs\LibAddonMenu-2.0\controls\button.lua
libs\LibAddonMenu-2.0\controls\checkbox.lua
libs\LibAddonMenu-2.0\controls\colorpicker.lua
libs\LibAddonMenu-2.0\controls\custom.lua
libs\LibAddonMenu-2.0\controls\description.lua
libs\LibAddonMenu-2.0\controls\dropdown.lua
libs\LibAddonMenu-2.0\controls\editbox.lua
libs\LibAddonMenu-2.0\controls\header.lua
libs\LibAddonMenu-2.0\controls\slider.lua
libs\LibAddonMenu-2.0\controls\texture.lua

--stuff that needs libStub or LAM 2.0, but not the converter

--The interface comes here to add it's function around/next too the LAM 2.0 API.
libs\LAM-1to2-Interface-1.0.lua

--otehr stuff that needs libStub, LAM 2.0 or the converter

--your own code files come here
Of course also add optional dependecies to libStub, LAM 2.0, the covnerter and the like. So Local Copies (wich are more likely up to date) get run before your embedded files.
Last edited by zgrssd : 06/18/14 at 04:35 AM.
Report comment to moderator  
Reply With Quote
Unread 06/18/14, 04:18 AM  
zgrssd
AddOn Author - Click to view AddOns

Forum posts: 280
File comments: 26
Uploads: 3
As I understand it, it takes your existing LAM 1.0 function calls and makes a LAM 2.0 table for you from that.
It then hands the automagically crafted table to LAM 2.0 for display.
So you don't have to rewrite more then 1-2 lines of your addon while still having the new LAM 2.0 look and bugfxies (like re-using elements to avoid 'too many anchors' problem). I was actually hoping for something like this to be part of the LAM 2.0 API, but this works too.

I could really use this as I only use simplest case menu's so far, but will propably learn LAM 2.0 in the long run. Table based approaches are closer to XML and XAML, so I think it is better in the long run.
Last edited by zgrssd : 06/18/14 at 04:19 AM.
Report comment to moderator  
Reply With Quote
Unread 06/12/14, 03:44 PM  
Tanthul
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 32
Uploads: 1
Originally Posted by Sasky
It is a bridge interface or Adapter pattern.
For performance, it's a straight passthrough of references on initial setup, so negligible cost.
I'm not worried about the performance cost but rather having to manage 2 dependencies for the same thing and deal with double possible quirks/issues in the long run.
As a person who's had more than his share of dealing with C/C++ libraries on business and open source projects, I have made it a habit of avoiding any dependencies I can actually avoid It's a matter of philosophy and reducing amount of possible points of failure

That said, personally I don't like the table-based interface for LAM-2.0, so I'll probably keep using such an adapter.
Well I have not checked it out yet so I can't really comment but by the looks of it you trade some ease of use for extra capabilites. Thing is I am pretty sure that v1 is not going to be maintained any more so migration is the only way to go, although I do not need the extra capabilities now or in the forseeable future. At least for my current addon project

Thank you for answering my question!
Last edited by Tanthul : 06/12/14 at 03:44 PM.
Report comment to moderator  
Reply With Quote
Unread 06/12/14, 01:33 PM  
Sasky
AddOn Author - Click to view AddOns

Forum posts: 231
File comments: 87
Uploads: 4
Originally Posted by Tanthul
Hi,

Is this supposed to be a bridge interface, a one-time converter or both? Because it's not obvious in the description. I am interested in saving some time in converting but not on relying on an additional bridge interface dependency. If this is a bridge interface only then I'd rather take the time to manually convert

Thanks in advance,
Tanthul
It is a bridge interface or Adapter pattern.
For performance, it's a straight passthrough of references on initial setup, so negligible cost.

I threw it up here so authors with simple option menus could quickly (~5min) throw in LAM-2.0 and take a longer time to explore/rewrite for LAM-2.0 and its new features.

That said, personally I don't like the table-based interface for LAM-2.0, so I'll probably keep using such an adapter.
Report comment to moderator  
Reply With Quote
Unread 06/12/14, 12:35 PM  
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 169
Uploads: 11
Originally Posted by Tanthul
Hi,

Is this supposed to be a bridge interface, a one-time converter or both? Because it's not obvious in the description. I am interested in saving some time in converting but not on relying on an additional bridge interface dependency. If this is a bridge interface only then I'd rather take the time to manually convert

Thanks in advance,
Tanthul
i was confizzled too as to what this did, basically you remove LAM1 out of your *.txt file and add in LAM2 and LAM-1to2-Interface-1.0 references in your txt then replace

local LAM = LibStub("LibAddonMenu-1.0")
to
local LAM = LibStub("LibAddonMenu-1.0-to-2.0")
in your *.lua file and it doesnt require you to rewrite LAM1 menu it just ports it into the LAM2 panel

** Addons must have unique names tho so for ppl that have multiple addons all under the same panel name will need to name each one unique like all mine are under ("_SkOODaT", "SkOODaTs Addons") but i would half to name them all unique (""_SkOODaTAddon1", "SkOODaTs Addon 1") i dont think LAM2 supports multi addon under a single panel
Report comment to moderator  
Reply With Quote
Unread 06/12/14, 06:10 AM  
Tanthul
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 32
Uploads: 1
Hi,

Is this supposed to be a bridge interface, a one-time converter or both? Because it's not obvious in the description. I am interested in saving some time in converting but not on relying on an additional bridge interface dependency. If this is a bridge interface only then I'd rather take the time to manually convert

Thanks in advance,
Tanthul
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: