Author: richard
Date: Tue Feb 17 10:34:04 2009
New Revision: 4249

URL: http://svn.slimdevices.com/jive?rev=4249&view=rev
Log:
 r4...@harrypotter (orig r4248):  richard | 2009-02-17 18:32:43 +0000
 Bug: N/A
 Description:
 Mini applet to assist debugging skins, enable/disable using } on the keyboard, 
then mouse 
 around.
 
 

Added:
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/
    
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Canvas.lua
Modified:
    7.4/branches/pango/   (props changed)
    
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/InputToActionMap.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c

Propchange: 7.4/branches/pango/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Feb 17 10:34:04 2009
@@ -4,7 +4,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.2/trunk:2921
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/private-branches/jive-refresh:3653
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:4138
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4243
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4248
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Added: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua?rev=4249&view=auto
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
 (added)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
 Tue Feb 17 10:34:04 2009
@@ -1,0 +1,90 @@
+
+local oo            = require("loop.simple")
+
+local AppletMeta    = require("jive.AppletMeta")
+
+local Canvas        = require("jive.ui.Canvas")
+local Framework     = require("jive.ui.Framework")
+
+local debug         = require("jive.utils.debug")
+local log           = require("jive.utils.log").logger("ui")
+
+local appletManager = appletManager
+
+
+module(..., Framework.constants)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(meta)
+       return 1, 1
+end
+
+
+function defaultSettings(meta)
+end
+
+
+function registerApplet(meta)
+end
+
+
+function configureApplet(meta)
+       Framework:addActionListener("debug_skin", meta, _debugSkin, 9999)
+end
+
+
+function _debugWidget(meta, screen, widget)
+       if meta.mouseEvent and widget:mouseInside(meta.mouseEvent) then
+               local x,y,w,h = widget:getBounds()
+               screen:filledRectangle(x,y, x+w,y+h, 0xFF00003F)
+
+               log:info("-> ", widget, " (", x, ",", y, " ", w, "x", h, ")")
+       end
+
+       widget:iterate(function(child)
+               _debugWidget(meta, screen, child)
+       end)
+end
+
+
+function _debugSkin(meta)
+       if meta.enabled then
+               meta.enabled = nil
+
+               Framework:removeWidget(meta.canvas)
+               Framework:removeListener(meta.mouseListener)
+
+               return
+       end
+
+       meta.enabled = true
+
+       meta.canvas = Canvas("blank", function(screen)
+               local window = Framework.windowStack[1]
+
+               log:info("Mouse in: ", window)
+               window:iterate(function(w)
+                       _debugWidget(meta, screen, w)
+               end)
+       end)
+       Framework:addWidget(meta.canvas)
+
+       meta.mouseListener = Framework:addListener(EVENT_MOUSE_ALL,
+               function(event)
+                       meta.mouseEvent = event
+                       Framework:reDraw(nil)
+               end, -99)
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2007 Logitech. All Rights Reserved.
+
+This file is subject to the Logitech Public Source License Version 1.0. Please 
see the LICENCE file for details.
+
+=cut
+--]]

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/InputToActionMap.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/InputToActionMap.lua?rev=4249&r1=4248&r2=4249&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/InputToActionMap.lua 
(original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/InputToActionMap.lua 
Tue Feb 17 10:34:04 2009
@@ -57,6 +57,7 @@
        ["7"]  = "play_favorite_7",
        ["8"]  = "play_favorite_8",
        ["9"]  = "play_favorite_9",
+       ["}"]  = "debug_skin",
 
 }
 

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua?rev=4249&r1=4248&r2=4249&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua Tue 
Feb 17 10:34:04 2009
@@ -58,6 +58,8 @@
 local Task          = require("jive.ui.Task")
 local Timer         = require("jive.ui.Timer")
 local Event         = require("jive.ui.Event")
+
+local Canvas        = require("jive.ui.Canvas")
 
 local _inputToActionMap = require("jive.InputToActionMap")
 
@@ -259,6 +261,7 @@
 --     profiler.stop()
 end
 
+
 function JiveMain:jiveMainNodes(globalStrings)
 
        -- this can be called after language change, 

Added: 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Canvas.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Canvas.lua?rev=4249&view=auto
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Canvas.lua 
(added)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Canvas.lua Tue 
Feb 17 10:34:04 2009
@@ -1,0 +1,41 @@
+
+--[[
+=head1 NAME
+
+jive.ui.Canvas - A canvas widget
+
+=head1 DESCRIPTION
+
+A canvas widget, this widget provides access to drawing on the screen
+in lua.
+
+--]]
+
+-- stuff we use
+local _assert, tostring, type, tolua = _assert, tostring, type, tolua
+
+local oo        = require("loop.simple")
+local Icon      = require("jive.ui.Icon")
+local Surface   = require("jive.ui.Surface")
+
+local log       = require("jive.utils.log").logger("ui")
+
+
+-- our class
+module(...)
+oo.class(_M, Icon)
+
+
+function __init(self, style, renderFunc)
+       _assert(type(renderFunc) == "function")
+
+       local obj = oo.rawnew(self, Icon(style))
+       obj.render = renderFunc
+
+       return obj
+end
+
+
+function draw(self, surface)
+       self.render(surface)
+end

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua?rev=4249&r1=4248&r2=4249&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua 
Tue Feb 17 10:34:04 2009
@@ -399,7 +399,7 @@
 function removeWidget(self, widget)
        _assert(oo.instanceof(widget, Widget))
 
-       table.delete(widget, widget)
+       table.delete(widgets, widget)
        widget:dispatchNewEvent(EVENT_HIDE)
 
        self:reDraw(nil)

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua?rev=4249&r1=4248&r2=4249&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua 
Tue Feb 17 10:34:04 2009
@@ -114,8 +114,9 @@
                        local item = list[indexList[i]]
 
                        local icon = item.icon or menu.icons[i]
+                       local iconStyle = item.iconStyle or "icon"
                        if icon == nil then
-                               icon = Icon("icon")
+                               icon = Icon(iconStyle)
                                menu.icons[i] = icon
                        end
 
@@ -129,7 +130,7 @@
                        else
                                widgetList[i]:setStyle(item.style or "item")
                                widgetList[i]:setWidgetValue("text", item.text)
-                               widgetList[i]:setWidget("icon", icon)
+                               widgetList[i]:setWidget(iconStyle, icon)
                        end
                end
        end

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c?rev=4249&r1=4248&r2=4249&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c Tue Feb 
17 10:34:04 2009
@@ -133,6 +133,19 @@
         * 1: widget
         * 2: closure
         */
+
+       // window widgets
+       lua_getfield(L, 1, "widgets");
+       lua_pushnil(L);
+       while (lua_next(L, -2) != 0) {
+               lua_pushvalue(L, 2);
+               lua_pushvalue(L, -2);
+               lua_call(L, 1, 1);
+
+               r = r | luaL_optinteger(L, -1, 0);
+               lua_pop(L, 2);
+       }
+       lua_pop(L, 1);
 
        lua_getfield(L, 1, "showFrameworkWidgets");
        if (lua_toboolean(L, -1)) {
@@ -152,19 +165,6 @@
        }
        lua_pop(L, 1);
 
-       // window widgets
-       lua_getfield(L, 1, "widgets");
-       lua_pushnil(L);
-       while (lua_next(L, -2) != 0) {
-               lua_pushvalue(L, 2);
-               lua_pushvalue(L, -2);
-               lua_call(L, 1, 1);
-
-               r = r | luaL_optinteger(L, -1, 0);
-               lua_pop(L, 2);
-       }
-       lua_pop(L, 1);
-
        lua_pushinteger(L, r);
        return 1;
 }

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to