Download
(10 Kb)
Download
Updated: 04-02-10 08:46 AM
Pictures
File Info
Updated:04-02-10 08:46 AM
Created:unknown
Downloads:4,703
Favorites:40
MD5:
cargoShip (Display)
Version: 2.1.5
by: Cargor [More]
Yet another rewrite! For compatibility with old layouts of version 2.0.5 and older, you have to add local cargoShip = LibStub("LibCargoShip-2.1") to the top of your file!.

cargoShip is a LibDataBroker display-addon and library which can only be configured through changing the Lua-code. It was designed to provide a lightweight and flexible framework for creating info blocks based on data objects.

It provides support for the following attributes (you can add more if you like):
  • icon, iconR, iconB, iconG, iconCoords
  • text, label, value, suffix
  • OnEnter, OnLeave, OnClick
  • tooltip, OnTooltipShow
You can add more of them (or change existing) by providing your custom functions in cargoShip.UpdateFunctions["attributeName"] = function(self, attribute, dataobj) end.

The addon comes with a sample layout which gives you a good start on creating and positioning your elements (in the layout.lua - with comments). Please note that I most likely use different LDB-data sources than you do

A short function reference (the complete one is on my GitHub repo):
  • block = cargoShip("name" [, options]) - returns a new info block of the specified LDB-data source
  • block = cargoShip(options) - returns a new info block of the specified LDB-data source in options.name
  • blocks = cargoShip:Get(dataObject) - returns a table of all created blocks for this data source
  • block = cargoShip:GetFirst(dataObject) - returns a table of all created blocks for this data source
  • cargoShip:GetUnused(verbose) - returns a table of all unused data sources, and optionally prints it to chat
  • block:SetDataObject(dataObject) - set a new data source for the block

Please drop a comment for your feedback, bug reports and/or suggestions.
2.1.5
* new option: textColor
* new options: shadowX, shadowY
- forgot to mention: option noText
- fixed tagString

2.1
* major rewrite
* your old layout.lua should be still compatible, but you have to add "local cargoShip = LibStub("LibCargoShip-2.1")" at the top.
* new function: block:SetDataObject(dataObject) - change the data object after the creation!
* new function: cargoShip:GetFirst(dataObject) - returns the first block for this data object
* changed function: cargoShip:GetUnused(verbose) - if set to true, it prints out the unused dataobjects

- removed: options.Formatting (use tagStrings for this purpose!)
- removed: global 'cargoShip' variable
- removed: cargoShip:PrintUnused() - see cargoShip:GetUnused(true)
- you can now make your own block prototypes, see the library embedding functions

2.0.5
- fixed the .toc and included the right lib-version, whew

2.0.3
* simple tag-system included:
* format your layouts by defining options.tagString, e.g. "[Name]: [value][suffix]"

- fixed: not updating if only dataObj.iconB changes
- new: creation by name is now optional, you can specify the name in the options
- new: creation asserts if no name was found

2.0
- updated .toc to 30000
- fixed error with TipHooker-1.0
Optional Files (0)


Archived Files (5)
File Name
Version
Size
Author
Date
2.1
10kB
Cargor
03-08-10 12:44 PM
2.0.5
8kB
Cargor
08-26-09 06:32 AM
2.0.3
8kB
Cargor
08-24-09 08:01 AM
2.0
8kB
Cargor
07-02-09 09:28 AM
r311
8kB
Cargor
11-20-08 11:55 AM


Post A Reply Comment Options
Unread 06-20-09, 12:26 PM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 430
Uploads: 8
Originally posted by Cargor
Well, display on mouseover is nothing that cargoShip does by itself, you would have to write your own functions for that in the layout. I would come up with a code snippet for you, but I'm very busy at the moment

/script cargoShip:PrintUnused() does it, you don't need /print before it, because the function already prints it to the default chatframe.
Hello, thanks for your reply. I actually managed to make that show-on-mouseover panel:

Code:
--------> TOP PANEL
local f1 = CreateFrame("frame")
f1:SetPoint("TOP", UIParent, "TOP", 0, 0)
f1:SetWidth(350) f1:SetHeight(12)
f1:SetBackdrop({bgFile = "interface\\Tooltips\\UI-Tooltip-Background"})
f1:EnableMouse(true) 
f1:Show()
f1:SetAlpha(0)

local bauderrors = cargoShip("aBroker_BaudErrorFrame")
bauderrors:SetWidth(70)
bauderrors:SetPoint("TOP", UIParent, "TOP", 50, -1)
bauderrors:SetScript("OnEnter",function() ShowTop() end)
bauderrors:SetScript("OnLeave",function() HideTop() end)

local dominos = cargoShip("Dominos")
dominos:SetWidth(10)
dominos:SetPoint("LEFT", bauderrors, "RIGHT",10,0)
dominos:SetScript("OnEnter",function() ShowTop() end)
dominos:SetScript("OnLeave",function() HideTop() end)

local classtimer = cargoShip("ClassTimer")
classtimer:SetWidth(10)
classtimer:SetPoint("LEFT", dominos, "RIGHT", 10, 0)
classtimer:SetScript("OnEnter",function() ShowTop() end)
classtimer:SetScript("OnLeave",function() HideTop() end)

local dbm = cargoShip("Deadly Boss Mods")
dbm:SetWidth(40)
dbm:SetPoint("LEFT", classtimer, "RIGHT", 10, 0)
dbm:SetScript("OnEnter",function() ShowTop() end)
dbm:SetScript("OnLeave",function() HideTop() end)

local panda = cargoShip("Panda")
panda:SetWidth(55)
panda:SetPoint("LEFT", dbm, "RIGHT", 10, 0)
panda:SetScript("OnEnter",function() ShowTop() end)
panda:SetScript("OnLeave",function() HideTop() end)

local volume = cargoShip("Volumizer")
volume:SetWidth(15)
volume:SetPoint("LEFT", bigwigs, "RIGHT", 10, 0)
volume:SetScript("OnEnter",function() ShowTop() end)
volume:SetScript("OnLeave",function() HideTop() end)

local ora = cargoShip("oRA2")
ora:SetWidth(50)
ora:SetPoint("RIGHT", bauderrors, "LEFT", -5, 0)
ora:SetScript("OnEnter",function() ShowTop() end)
ora:SetScript("OnLeave",function() HideTop() end)

local nametoggle = cargoShip("Broker_NameToggle")
nametoggle:SetWidth(80)
nametoggle:SetPoint("RIGHT", ora, "LEFT", -5, 0)
nametoggle:SetScript("OnEnter",function() ShowTop() end)
nametoggle:SetScript("OnLeave",function() HideTop() end)

local hatter = cargoShip("aBroker_Hatter")
hatter:SetWidth(55)
hatter:SetPoint("RIGHT", nametoggle, "LEFT")
hatter:SetScript("OnEnter",function() ShowTop() end)
hatter:SetScript("OnLeave",function() HideTop() end)

local buffet = cargoShip("Buffet")
buffet:SetWidth(20)
buffet:SetPoint("RIGHT", hatter, "LEFT")
buffet:SetScript("OnEnter",function() ShowTop() end)
buffet:SetScript("OnLeave",function() HideTop() end)

function ShowTop()
local a1 = 1
bauderrors:SetAlpha(a1)
dominos:SetAlpha(a1)
classtimer:SetAlpha(a1)
panda:SetAlpha(a1)
volume:SetAlpha(a1)
ora:SetAlpha(a1)
nametoggle:SetAlpha(a1)
hatter:SetAlpha(a1)
buffet:SetAlpha(a1)
dbm:SetAlpha(a1)
end

function HideTop()
local a1 = 0 
bauderrors:SetAlpha(a1)
dominos:SetAlpha(a1)
classtimer:SetAlpha(a1)
panda:SetAlpha(a1)
volume:SetAlpha(a1)
ora:SetAlpha(a1)
nametoggle:SetAlpha(a1)
hatter:SetAlpha(a1)
buffet:SetAlpha(a1)
dbm:SetAlpha(a1)
end

HideTop()
f1:SetScript("OnEnter",function() ShowTop() end)
f1:SetScript("OnLeave",function() HideTop() end)
It works fine, but there is some kind of conflict with couple of launchers like dominos and dbm in my case:

for some reason when I mouseover one of those launchers on that panel whole panel vanishes and tooltip spawns instead.

e.g.
pic1: mouseover any element in that screen area - my panel shows up
http://idfiles.homeip.net/UploadImag...009_001831.jpg

pic2: and when I mouseover dominos launcher the panel disappears
http://idfiles.homeip.net/UploadImag...009_002219.jpg

If I remove tooltip spawning code in those launchers (i.e. onEnter/Leave handlers) everything works fine, but without tooltips which is sad
Monolit is offline Report comment to moderator  
Reply With Quote
Unread 05-31-09, 12:09 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Well, display on mouseover is nothing that cargoShip does by itself, you would have to write your own functions for that in the layout. I would come up with a code snippet for you, but I'm very busy at the moment

/script cargoShip:PrintUnused() does it, you don't need /print before it, because the function already prints it to the default chatframe.
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Unread 05-29-09, 01:20 AM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 430
Uploads: 8
Excellent addon, thanks for your work! 15 Kib vs 350-ish (ButtonBin)
I managed to fix my layout in about 10 minutes, though there is 1 feature I miss:
With ButtonBin I used to hide most of the config launchers on the bar which was only visible on mouseover, so is there a way to make my data blocks visible only when I mouseover certain region?

EDIT: also if I understood it correctly /print cargoShip:PrintUnused() should print the names of all unused LDB blocks in my chat frame, but it doesn't (returns nil). Am I missing something?
Last edited by Monolit : 05-29-09 at 02:20 AM.
Monolit is offline Report comment to moderator  
Reply With Quote
Unread 11-18-08, 07:04 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Mhh okay, I'll look into it.

But a more detailed description of the problem could be helpful, what do you mean exactly by "breaking"?
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Unread 11-17-08, 06:53 PM  
Gnarkill
A Kobold Labourer

Forum posts: 1
File comments: 8
Uploads: 1
RatingBuster

The addon breaks ratingbuster. More specifically TipHooker-1.0.

If theres any way to fix it, i would love to hear. =)
Gnarkill is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.