Download
(10Kb)
Download
Updated: 04-02-10 08:46 AM
Pictures
File Info
Updated:04-02-10 08:46 AM
Created:unknown
Downloads:5,938
Favorites:39
MD5:

cargoShip (Display)  Popular! (More than 5000 hits)

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)


Post A Reply Comment Options
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. =)
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: 374
Uploads: 18
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!
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: 428
Uploads: 7
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.
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: 374
Uploads: 18
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!
Report comment to moderator  
Reply With Quote
Unread 06-20-09, 12:26 PM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 428
Uploads: 7
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
Report comment to moderator  
Reply With Quote
Unread 06-28-09, 05:51 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
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!
Report comment to moderator  
Reply With Quote
Unread 06-28-09, 12:10 PM  
Monolit
A Black Drake
AddOn Author - Click to view AddOns

Forum posts: 81
File comments: 428
Uploads: 7
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
Report comment to moderator  
Reply With Quote
Unread 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
Report comment to moderator  
Reply With Quote
Unread 07-17-09, 05:48 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
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.
Report comment to moderator  
Reply With Quote
Unread 07-22-09, 05:36 AM  
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view AddOns

Forum posts: 115
File comments: 64
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.
Report comment to moderator  
Reply With Quote
Unread 07-22-09, 10:03 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
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!
Report comment to moderator  
Reply With Quote
Unread 07-30-09, 08:07 AM  
drdead
A Murloc Raider

Forum posts: 6
File comments: 20
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()
Report comment to moderator  
Reply With Quote
Unread 07-30-09, 02:38 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
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!
Report comment to moderator  
Reply With Quote
Unread 07-31-09, 12:31 PM  
drdead
A Murloc Raider

Forum posts: 6
File comments: 20
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.
Report comment to moderator  
Reply With Quote
Unread 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)
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.