Author: richard
Date: Thu Mar 26 07:53:08 2009
New Revision: 4957

URL: http://svn.slimdevices.com/jive?rev=4957&view=rev
Log:
 r4...@harrypotter (orig r4927):  tom | 2009-03-24 16:58:31 +0000
 Bug: 11440
 Description: 
 Fixed again, but this time so Richard doesn't gag
 - Add support for zOrder widget style parameter, used initially with 
DebugSkinMeta
 

Modified:
    7.4/branches/pango/   (props changed)
    
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
    
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DefaultSkin/DefaultSkinApplet.lua
    
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/Window.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive.h
    7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
    7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_widget.c
    7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_window.c
    
7.4/branches/pango/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua

Propchange: 7.4/branches/pango/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Mar 26 07:53:08 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:4842
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4911
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4927
 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

Modified: 
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=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
 (original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DebugSkin/DebugSkinMeta.lua
 Thu Mar 26 07:53:08 2009
@@ -10,6 +10,7 @@
 local log           = require("jive.utils.log").logger("ui")
 
 local appletManager = appletManager
+local jiveMain      = jiveMain
 
 
 module(..., Framework.constants)
@@ -30,6 +31,9 @@
 
 
 function configureApplet(meta)
+
+       Framework:addActionListener("reload_skin", meta, 
_reloadSkinFromDiskAction, 9999)
+
        Framework:addActionListener("debug_skin", meta, _debugSkin, 9999)
 end
 
@@ -63,12 +67,15 @@
                Framework:removeWidget(meta.canvas)
                Framework:removeListener(meta.mouseListener)
 
+               --reload skin, so existing windows will pick up the canvas 
change
+               _reloadSkinFromDiskAction(meta)
+
                return
        end
 
        meta.enabled = true
 
-       meta.canvas = Canvas("blank", function(screen)
+       meta.canvas = Canvas("debug_canvas", function(screen)
                local window = Framework.windowStack[1]
 
                log:info("Mouse in: ", window)
@@ -76,13 +83,22 @@
                        _debugWidget(meta, screen, w)
                end)
        end)
-       Framework:addWidget(meta.canvas, true)
+       Framework:addWidget(meta.canvas)
+
+       --reload skin, so existing windows will pick up the canvas change
+       _reloadSkinFromDiskAction(meta)
 
        meta.mouseListener = Framework:addListener(EVENT_MOUSE_ALL,
                function(event)
                        meta.mouseEvent = event
                        Framework:reDraw(nil)
                end, -99)
+end
+
+function _reloadSkinFromDiskAction(self, event)
+       --free first so skin changes can be seen without jive rerun
+       jiveMain:freeSkin()
+       jiveMain:reloadSkin()
 end
 
 

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DefaultSkin/DefaultSkinApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DefaultSkin/DefaultSkinApplet.lua?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DefaultSkin/DefaultSkinApplet.lua
 (original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/DefaultSkin/DefaultSkinApplet.lua
 Thu Mar 26 07:53:08 2009
@@ -1909,6 +1909,9 @@
 
        -- END NowPlaying skin code
 
+       s.debug_canvas = {
+                       zOrder =9999
+       }
 
 end
 

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=4957&r1=4956&r2=4957&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 
Thu Mar 26 07:53:08 2009
@@ -57,6 +57,9 @@
        ["7"]  = "play_favorite_7",
        ["8"]  = "play_favorite_8",
        ["9"]  = "play_favorite_9",
+
+       --development tools -- Later when modifier keys are supported, these 
could be obscured from everyday users
+       ["R"]  = "reload_skin",
        ["}"]  = "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=4957&r1=4956&r2=4957&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 Thu 
Mar 26 07:53:08 2009
@@ -400,6 +400,14 @@
        _loadSkin(self, self.selectedSkin, true);
 end
 
+function JiveMain:freeSkin()
+       log:error("self.selectedSkin: ", self.selectedSkin)
+
+       if not self.skins[self.selectedSkin] then
+               return false
+       end
+       appletManager:freeApplet(self.selectedSkin)
+end
 
 function JiveMain:setDefaultSkin(appletName)
        log:debug("setDefaultSkin(", appletName, ")")

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=4957&r1=4956&r2=4957&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 
Thu Mar 26 07:53:08 2009
@@ -89,7 +89,6 @@
 -- initial global state
 windowStack = {}
 widgets = {} -- global widgets
-onTopWidgets = {} -- global "on top" widgets
 globalListeners = {} -- global listeners
 unusedListeners = {} -- unused listeners
 animations = {} -- active widget animations
@@ -380,14 +379,10 @@
 
 =cut
 --]]
-function addWidget(self, widget, onTop)
+function addWidget(self, widget)
        _assert(oo.instanceof(widget, Widget))
 
-       if onTop then
-               onTopWidgets[#onTopWidgets + 1] = widget
-       else
-               widgets[#widgets + 1] = widget
-       end
+       widgets[#widgets + 1] = widget
        widget:dispatchNewEvent(EVENT_SHOW)
 
        self:reDraw(nil)
@@ -406,10 +401,14 @@
        _assert(oo.instanceof(widget, Widget))
 
        table.delete(widgets, widget)
-       table.delete(onTopWidgets, widget)
        widget:dispatchNewEvent(EVENT_HIDE)
 
        self:reDraw(nil)
+end
+
+
+function getWidgets(self)
+       return widgets  
 end
 
 

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua Thu 
Mar 26 07:53:08 2009
@@ -147,6 +147,7 @@
        obj.transparent = false
 
        obj.widgets = {} -- child widgets
+       obj.zWidgets = {} -- child widgets and framework widgets in z order
        obj.layoutRoot = true
        obj.focus = nil
 
@@ -1473,6 +1474,42 @@
 end
 
 
+function _layout(self)
+       local stableSortCounter = 1
+
+       self.zWidgets = {}
+       for i, widget in ipairs(self.widgets) do
+               if widget then
+                       widget._stableSortIndex = stableSortCounter
+                       table.insert(self.zWidgets, widget)
+
+                       stableSortCounter = stableSortCounter + 1
+               end
+       end
+
+       if self:getShowFrameworkWidgets() then
+               for i, widget in ipairs(Framework:getWidgets()) do
+                       if widget then
+                               widget._stableSortIndex = stableSortCounter
+                               table.insert(self.zWidgets, widget)
+                               stableSortCounter = stableSortCounter + 1
+                       end
+               end
+       end
+
+       table.sort(self.zWidgets,
+               function(a, b)
+                       --stable sort (since quicksort isn't stable by default) 
--  also check for unset (happens before pack)
+                       if a:getZOrder() == b:getZOrder() or not a:getZOrder() 
or not b:getZOrder()then
+                               return a._stableSortIndex < b._stableSortIndex
+                       end
+                       return a:getZOrder() < b:getZOrder()
+               end)
+
+       self:_skinLayout()
+end
+
+
 --[[ C optimized:
 
 jive.ui.Window:pack()

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive.h
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive.h?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive.h (original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive.h Thu Mar 26 
07:53:08 2009
@@ -192,6 +192,7 @@
        Uint32 layout_origin;
        JiveAlign align;
        Uint8 layer;
+       Sint16 z_order;
 };
 
 struct jive_surface {
@@ -435,6 +436,7 @@
 
 int jiveL_widget_set_bounds(lua_State *L);
 int jiveL_widget_get_bounds(lua_State *L);
+int jiveL_widget_get_z_order(lua_State *L);
 int jiveL_widget_get_preferred_bounds(lua_State *L);
 int jiveL_widget_get_border(lua_State *L);
 int jiveL_widget_mouse_bounds(lua_State *L);

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_framework.c 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Thu 
Mar 26 07:53:08 2009
@@ -1287,6 +1287,7 @@
 static const struct luaL_Reg widget_methods[] = {
        { "setBounds", jiveL_widget_set_bounds }, 
        { "getBounds", jiveL_widget_get_bounds },
+       { "getZOrder", jiveL_widget_get_z_order },
        { "getPreferredBounds", jiveL_widget_get_preferred_bounds },
        { "getBorder", jiveL_widget_get_border },
        { "mouseBounds", jiveL_widget_mouse_bounds },

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_widget.c
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_widget.c?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_widget.c 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/src/ui/jive_widget.c Thu Mar 
26 07:53:08 2009
@@ -28,6 +28,7 @@
        /* layer from style */
        data->layer = jive_style_int(L, 1, "layer", JIVE_LAYER_CONTENT);
 
+       data->z_order = jive_style_int(L, 1, "zOrder", 0);
        JIVEL_STACK_CHECK_END(L);
 }
 
@@ -111,6 +112,20 @@
        lua_pushinteger(L, peer->bounds.w);
        lua_pushinteger(L, peer->bounds.h);
        return 4;
+}
+
+
+int jiveL_widget_get_z_order(lua_State *L) {
+       JiveWidget *peer;
+
+       lua_getfield(L, 1, "peer");
+       peer = lua_touserdata(L, -1);
+       if (!peer) {
+               return 0;
+       }
+
+       lua_pushinteger(L, peer->z_order);
+       return 1;
 }
 
 

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=4957&r1=4956&r2=4957&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 Thu Mar 
26 07:53:08 2009
@@ -47,7 +47,7 @@
        lua_pushstring(L, "layout"); // key
        jive_getmethod(L, 1, "borderLayout"); // default
        lua_call(L, 3, 1);
-       lua_setfield(L, 1, "_layout");
+       lua_setfield(L, 1, "_skinLayout");
 
        bg_tile = jive_style_tile(L, 1, "bgImg", NULL);
        if (bg_tile != peer->bg_tile) {
@@ -134,26 +134,8 @@
         * 2: closure
         */
 
-       lua_getfield(L, 1, "showFrameworkWidgets");
-       if (lua_toboolean(L, -1)) {
-               // global widgets
-               jiveL_getframework(L);
-               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, 2);
-       }
-       lua_pop(L, 1);
-       
-       // window widgets
-       lua_getfield(L, 1, "widgets");
+       // window widgets in z order
+       lua_getfield(L, 1, "zWidgets");
        lua_pushnil(L);
        while (lua_next(L, -2) != 0) {
                lua_pushvalue(L, 2);
@@ -164,20 +146,6 @@
                lua_pop(L, 2);
        }
        lua_pop(L, 1);
-
-       // global "on top" widgets
-       jiveL_getframework(L);
-       lua_getfield(L, -1, "onTopWidgets");
-       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, 2);
 
        lua_pushinteger(L, r);
        return 1;

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.4/branches/pango/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua?rev=4957&r1=4956&r2=4957&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
 (original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
 Thu Mar 26 07:53:08 2009
@@ -1792,6 +1792,9 @@
        s.iconbg.border = { 0, 0, 0, 0 }
        s.iconbg.position = LAYOUT_NONE
 
+       s.debug_canvas = {
+                       zOrder = 9999
+       }
 
 end
 

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

Reply via email to