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,659
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 11:44 AM
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 10:55 AM


Post A Reply Comment Options
Old 08-26-09, 12:24 AM  
rossman
A Cyclonian
 
rossman's Avatar
AddOn Author - Click to view AddOns

Forum posts: 39
File comments: 11
Uploads: 2
File location

Inside your addon folder the location of the files changed but the TOC does not match.
rossman is offline Report comment to moderator  
Reply With Quote
Old 08-25-09, 09:07 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Are there any errors? Otherwise it's difficult to find the problem :/
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 08-25-09, 07:20 AM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 430
Uploads: 8
I can't get my layout (that worked with 2.0) to load with the latest version :/
here's my layout.lua:
http://pastey.net/123328
Monolit is offline Report comment to moderator  
Reply With Quote
Old 08-17-09, 01:35 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Thanks for the report! I'll fix it as soon as I'm back from holiday.
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 08-16-09, 08:50 PM  
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view AddOns

Forum posts: 125
File comments: 69
Uploads: 11
I believe your code at line 185 should be changed to self.Text

Code:
self.Label:SetFormattedText(self.Formatting, dataobj.value, dataobj.suffix)
Bruners is offline Report comment to moderator  
Reply With Quote
Old 07-31-09, 12:31 PM  
drdead
A Murloc Raider

Forum posts: 6
File comments: 23
Uploads: 0
Originally posted by Cargor
You could take a look at DummyBar. There you can move all Blizz-frames a bit down by using "/dummybar top 24" (or another value for the height).
Tnx a lot.
drdead is offline Report comment to moderator  
Reply With Quote
Old 07-30-09, 02:38 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
You could take a look at DummyBar. There you can move all Blizz-frames a bit down by using "/dummybar top 24" (or another value for the height).
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 07-30-09, 08:07 AM  
drdead
A Murloc Raider

Forum posts: 6
File comments: 23
Uploads: 0
Hello Cargor. Tnx for great addon. I created frame int layout.lua to attach LDB launchers to it but that frame doesnt move other frames, and i need all frames that cross with it go down (i have minimap at the upper right corner w\o addons that overrides "panel" i created, so i cant move it). What i need to add?

Code:
local fr = CreateFrame("Frame") 
fr:SetFrameStrata("BACKGROUND")
fr:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0) 
fr:SetWidth(900) 
fr:SetHeight(15) 
fr:SetScale(1.2)
fr:SetBackdropColor(0, 0, 0) 
fr:SetClampedToScreen(true)
fr:EnableMouse(true) 
fr:Show()
drdead is offline Report comment to moderator  
Reply With Quote
Old 07-22-09, 10:03 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Whoops, I'll fix it in another version. In the meantime, parenting the objects to UIParent should work:
object:SetParent(UIParent)
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 07-22-09, 05:36 AM  
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view AddOns

Forum posts: 115
File comments: 65
Uploads: 1
I've noticed that the display is still shown when you hide the interface (default "Z" if i remember correctly). Is this intentional? It's not a big deal for me as I don't use it often, but some might like a way to hide it with it.
Dainton is offline Report comment to moderator  
Reply With Quote
Old 07-17-09, 05:48 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
I'll check it as soon as possible.

EDIT: Just looked into Ara_Broker_XP and Ara somehow likes to add color information to the data broker name. So, you have to define the name in cargoShip on the same way:

|cFFFFB366Ara|r XP
|cFFFFB366Ara|r Tradeskills
|cFFFFB366Ara|r Guild

If some others don't work, it's a good start to find the exact name of the data object in the broker-file. Just search for "NewDataObject" and the name should usually appear in the bracket after it
__________________
Website | GitHub

Oh hai!
Last edited by xConStruct : 07-17-09 at 06:11 AM.
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 07-16-09, 09:28 PM  
rossman
A Cyclonian
 
rossman's Avatar
AddOn Author - Click to view AddOns

Forum posts: 39
File comments: 11
Uploads: 2
all Ara broker items

I cant get them to show up. I have alot of other brokers working but no luck with any of them from that authors. Most likely its me but any help would be appriciated.
Thanks
rossman is offline Report comment to moderator  
Reply With Quote
Old 06-28-09, 12:10 PM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 430
Uploads: 8
Originally posted by Cargor
Sorry for the late response, had a lot to do

The frame disappears, because you basically "leave" the panel and "enter" the display-block. Blizz' API about entering/leaving is not very clever, so they don't really check if the panel is still underneath your mouse (and the block).

Try to use this script:
Code:
local updateFrame = CreateFrame"Frame"
updateFrame:SetScript("OnUpdate", function(self)
    if(not MouseIsOver(f1)) then
        HideTop()
        self:Hide()
    end
end
And add in ShowTop() the following to make use of it: updateFrame:Show()
This update-routine basically checks as soon as you entered the panel every time if your mouse is still over the frame and so bypasses the false OnLeave.

By the way, why don't you make all blocks in the panel as the panel's child with dominos:SetParent(f1) - Then you don't have to set the alpha-values for each block manually, because they inherit it from the panel.

Hope, this works, as I didn't test it
Great! Just great, this method worked. I had to do some minor modifications to code you posted:
Code:
local updateFrame = CreateFrame("Frame")
updateFrame:SetScript("OnUpdate", function(self)
    if(MouseIsOver(f1)) then
        ShowTop()
        self:Show()
    else
	HideTop()
	self:Hide()
    end
end)
and everything worked as I wanted.

Also thanks for the tip to use SetParent method, my layout code looks much cleaner now :P
http://pastey.net/116841
Monolit is offline Report comment to moderator  
Reply With Quote
Old 06-28-09, 05:51 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 376
Uploads: 20
Sorry for the late response, had a lot to do

The frame disappears, because you basically "leave" the panel and "enter" the display-block. Blizz' API about entering/leaving is not very clever, so they don't really check if the panel is still underneath your mouse (and the block).

Try to use this script:
Code:
local updateFrame = CreateFrame"Frame"
updateFrame:SetScript("OnUpdate", function(self)
    if(not MouseIsOver(f1)) then
        HideTop()
        self:Hide()
    end
end
And add in ShowTop() the following to make use of it: updateFrame:Show()
This update-routine basically checks as soon as you entered the panel every time if your mouse is still over the frame and so bypasses the false OnLeave.

By the way, why don't you make all blocks in the panel as the panel's child with dominos:SetParent(f1) - Then you don't have to set the alpha-values for each block manually, because they inherit it from the panel.

Hope, this works, as I didn't test it
__________________
Website | GitHub

Oh hai!
xConStruct is offline Report comment to moderator  
Reply With Quote
Old 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
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.