PDA

View Full Version : Navigating the Jive source code



cliveb
2007-11-18, 02:35
Background: I added a comment to Bugzilla in support of an enhancement request. The reply came back that it was in consideration, but why not learn LUA and have a go myself?

Well, I've started trying to do just that. LUA is an interesting language. Compact, elegant, and powerful. But on the downside, it seems to be one of those "write-only" languages. I'm having real trouble finding my way around the LUA source code in Jive. The documentation (in the jive/doc/html folder) is pretty sparse.

[A specific example: in DefaultSkinApplet's "skin" function, it sets up "s.albumitem". I have searched the entire Jive source code (both LUA and C code), and absolutely nowhere is there a reference to "albumitem". But I know it affects the interface, because I've adjusted some values and observed the resulting changes. I can only conclude that perhaps the name "albumitem" is being constructed dynamically somewhere, but finding it seems an almost hopeless task].

Are there any documents around that describe the overall structure of the Jive source code?

Fred
2007-11-18, 19:11
[A specific example: in DefaultSkinApplet's "skin" function, it sets up "s.albumitem"...

You did not pick the most straightforward bit in the code :) The style thing is a simplified version of CSS and SlimBrowser is a complex machine.

You can see "albumitem" being built in SlimBrowserApplet.lua, line 352. It's used when rendering the menu, line 1268 (making a decoratedLabel).
The C code will look at the content of table s.albumitem (what you changed) to determine how to draw the bits.


But on the downside, it seems to be one of those "write-only" languages. I'm having real trouble finding my way around the LUA source code in Jive. The documentation (in the jive/doc/html folder) is pretty sparse.

Arguably, the sparse docs assumes some level of Lua knowledge. At least the docs exists, checked the ones for SqueezeCenter lately? :)
Now, I agree what exists is mainly reference material and not walkthrough material. So the best option is to persevere and ask here if/when you hit any roadblock.

HTH
Fred

cliveb
2007-11-19, 03:40
You did not pick the most straightforward bit in the code :) The style thing is a simplified version of CSS and SlimBrowser is a complex machine.
Adding an applet was pretty easy, but I'm trying to figure out how to disable the display of artwork, which as far as I can tell requires dynamically modifying the skin as the options are changed (in a "SetupArtworkDisplay" applet).


You can see "albumitem" being built in SlimBrowserApplet.lua, line 352. It's used when rendering the menu, line 1268 (making a decoratedLabel).
The C code will look at the content of table s.albumitem (what you changed) to determine how to draw the bits.
OK, thanks for the pointers. Hopefully it will open up a few more routes for me to explore.