Merge with develop

This commit is contained in:
Nimetu 2016-03-22 12:23:04 +02:00
parent 2d5cf29861
commit 6a258886fe
7 changed files with 819 additions and 4 deletions

View file

@ -447,6 +447,7 @@ XMLInterfaceFiles = {
"config.xml", "config.xml",
"widgets.xml", "widgets.xml",
"webig_widgets.xml", "webig_widgets.xml",
"appzone.xml",
"player.xml", "player.xml",
"inventory.xml", "inventory.xml",
"interaction.xml", "interaction.xml",

View file

@ -0,0 +1,192 @@
-- global
AppZone = {
id = "ui:interface:appzone",
homeuri = "?action=appzone_toolbar",
launchuri = "?action=launch_app",
addappuri = "?action=list_user_apps",
mode = "h_bar",
imagesize = 26
}
-- use client.cfg value when available
local uri getClientCfg("AppZoneUrl")
if uri == nil or uri == '' then
uri = 'http://app.ryzom.com/'
end
AppZone.homeuri = uri .. AppZone.homeuri
AppZone.launchuri = uri .. AppZone.launchuri
AppZone.addappuri = uri .. AppZone.addappuri
function AppZone:getRoot()
return getUI(self.id)
end
function AppZone:onButtonHome()
local webig = getUI("ui:interface:webig")
webig:find("html").url = self.addappuri
webig.active = true
end
function AppZone:calculateSize(count, spacer, mode)
local w, h
if mode == "h_bar" then
-- icon=32, space=2+2
w = count * self.imagesize + spacer * 15
w = w + 55 + 10 + 20
h = self.imagesize + 2
elseif mode == "h_box" then
w = count * self.imagesize
w = w + 20
h = self.imagesize + 2
h = h * spacer
h = h + 15
elseif mode == "v_bar" then
-- icon=32, space=2+2
h = count * self.imagesize + spacer * 15
h = h + 20 + 20 + 12
w = self.imagesize + 2 + 18
else
h = count * self.imagesize
h = h + 20 + 25
w = self.imagesize + 2
w = w * spacer
w = w + 16
end
local ui = getUI("ui:interface")
if w > ui.w then
w = ui.w
end
if h > ui.h then
h = ui.h
end
return w, h
end
function AppZone:setElementCount(count,spacer,m)
self.mode = m
local root = self:getRoot()
local content = root:find("content")
local html = root:find("html")
local button_toggle = root:find("toggle_mode")
local button_reload = root:find("browse_reload")
local button_home = root:find("browse_home")
local w, h = self:calculateSize(count, spacer, self.mode)
root.h = h
root.w = w
content.w = w
content.h = h
-- set position of buttons
if self.mode == "h_bar" then
-- button_toggle.posref = "BL BL"
button_toggle.x = 2
button_toggle.y = 0
-- button_reload.posref = "TL BL"
html.x = 15
html.y = 0
button_reload.x = -25
button_reload.y = -25
-- button_home.posref = "BR BR"
button_home.x = 0
button_home.y = -3 + 5
elseif self.mode == "h_box" then
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = -25
button_reload.y = -4 - 20
-- button_home.posref = "BR BR"
button_home.x = 0
button_home.y = -3 + h - 18
elseif self.mode == "v_bar" then
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = 0
button_reload.y = -4
-- button_home.posref = "BR BR"
button_home.x = 4 - 7
button_home.y = -3
else
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = -25
button_reload.y = -4 - 20
-- button_home.posref = "BR BR"
button_home.x = 0 - w + 54 + 12
button_home.y = -3
end
end
function AppZone:setMode(m)
self.mode = m
self:reload()
end
function AppZone:setActive(s)
self:getRoot().active = s
end
function AppZone:launchApp(appid, appwin, appurl)
if not appwin then
if string.match(appid, "^[0-9]+$") then
appwin = "app" .. tostring(appid)
else
appwin = "webig"
end
end
if not appurl then
appurl = self.launchuri .. "&appid=" .. tostring(appid)
end
if WebBrowser then
WebBrowser:openWindow(appwin, appurl)
else
-- fallback if WebBrowser not present
local webig = getUI("ui:interface:webig")
webig:find("html").url = appurl;
webig.active = true
end
end
function AppZone:reload()
local url = self.homeuri
url = url .. "&mode=" .. tostring(self.mode)
local html = self:getRoot():find("html")
html.url = url
end
-- slash command: /appzone <cmd>
function AppZone:handle(cmd)
if cmd == 'show' then
self:setActive(true)
elseif cmd == 'hide' then
self:setActive(false)
elseif cmd == 'reload' then
self:reload()
elseif cmd == 'list' then
self:onButtonHome()
else
self:launchApp(cmd)
end
end

View file

@ -0,0 +1,258 @@
<?xml version="1.0"?>
<interface_config>
<root id="interface"
x="0"
y="0"
w="800"
h="600"
active="true" />
<!-- default: active, h_bar -->
<variable entry="UI:VARIABLES:ISACTIVE:APPZONE"
type="sint32"
value="1" />
<variable entry="UI:SAVE:APPZONE:MODE"
type="sint32"
value="1" />
<!-- load lua after variable are setup -->
<lua file="appzone.lua" />
<lua file="webbrowser.lua" />
<proc id="appzone_proc_active">
<action handler="set"
params="dblink=UI:VARIABLES:ISACTIVE:APPZONE|value=1" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_deactive">
<action handler="set"
params="dblink=UI:VARIABLES:ISACTIVE:APPZONE|value=0" />
</proc>
<proc id="appzone_proc_mode_set">
<action handler="set"
params="dblink=UI:SAVE:APPZONE:MODE|value=@0" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_mode_inc">
<action handler="set"
params="dblink=UI:SAVE:APPZONE:MODE|value=add(@UI:SAVE:APPZONE:MODE,1)" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_mode">
<action handler="set"
cond="le(@UI:SAVE:APPZONE:MODE,0)"
params="dblink=UI:SAVE:APPZONE:MODE|value=1" />
<action handler="set"
cond="ge(@UI:SAVE:APPZONE:MODE,5)"
params="dblink=UI:SAVE:APPZONE:MODE|value=1" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,1)"
params="AppZone:setMode('h_bar')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,2)"
params="AppZone:setMode('h_box')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,3)"
params="AppZone:setMode('v_bar')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,4)"
params="AppZone:setMode('v_box')" />
</proc>
<group type="menu"
id="appzone_menu"
extends="base_menu_with_color">
<action id="settings"
name="uiBrowseHome"
handler="lua"
params="AppZone:onButtonHome()" />
<action id="reload"
name="uiBrowseRefresh"
handler="lua"
params="AppZone:reload()" />
<action id="hide"
name="uiHide"
handler="lua"
params="AppZone:setActive(false)" />
<separator />
</group>
<group id="appzone"
type="container"
x="0"
y="0"
w="200"
h="26"
posref="MM MM"
min_w="26"
min_h="26"
max_w="1600"
max_h="1600"
pop_max_w="1600"
pop_max_h="1600"
title=""
global_color="true"
global_color_over="true"
header_active="false"
right_button="false"
options="layer0_pad"
movable="true"
active="true"
opened="true"
openable="false"
resizer="false"
on_active="proc"
on_active_params="appzone_proc_active"
on_deactive="proc"
on_deactive_params="appzone_proc_deactive"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:appzone_menu">
<group id="header_closed"
x="0"
y="0"
w="0"
h="0"
posref="TL TL" />
<group id="header_opened"
x="0"
y="0"
w="0"
h="0"
wmin="5"
sizeref="w"
posref="TL TL" />
<group id="content"
x="0"
y="0"
w="0"
h="26"
posref="TL TL">
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="toggle_mode"
posref="BL BL"
x="2"
y="0"
tx_normal="tb_mode.tga"
tx_pushed="tb_mode.tga"
tooltip="uiMk_mode"
onclick_l="proc"
params_l="appzone_proc_mode_inc" />
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="browse_home"
posref="BR BR"
x="0"
y="-3"
tx_normal="r2_palette_components.tga"
tx_pushed="r2_palette_components.tga"
tooltip="uittBrowseHome"
onclick_l="lua"
params_l="AppZone:onButtonHome()" />
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="browse_reload"
posref="TL BL"
posparent="browse_home"
x="0"
y="-4"
tx_normal="r2ed_icon_rotate.tga"
tx_pushed="r2ed_icon_rotate.tga"
tooltip="uiBrowseRefresh"
onclick_l="lua"
params_l="AppZone:reload()" />
<group id="html"
type="webig_html"
posref="TL TL"
url=""
title_prefix=""
sizeref="wh"
x="15"
y="0"
w="0"
h="0"
background_color="0 0 0 0"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="255 255 255 255"
text_font_size="10"
h1_font_size="16"
h2_font_size="14"
h3_font_size="13"
h4_font_size="12"
h5_font_size="11"
h6_font_size="11"
paragraph_begin_space="12"
multi_line_space_factor="0.25"
td_begin_space="0"
li_begin_space="4"
ul_begin_space="12"
li_indent="-10"
ul_indent="30"
checkbox_bitmap_normal="patch_off.tga"
checkbox_bitmap_pushed="patch_on.tga"
checkbox_bitmap_over=""
background_bitmap_view=""
home=""
browse_next_time="false"
timeout="5"
form_text_area_group="edit_box_widget_multiline">
<group id="black"
posref="BR BR"
sizeref="hw"
w="0"
h="0"
inherit_gc_alpha="true" />
<view type="bitmap"
id="black2"
posparent="black"
posref="MM MM"
sizeref="wh"
w="0"
h="0"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
<group type="list"
id="text_list"
fontsize="9"
posref="TL TL"
posparent="black"
x="0"
y="0"
space="0"
sizeref="hw"
w="-4"
h="0"
maxelements="2000" />
<ctrl style="skin_scroll"
id="scroll_bar" />
</group>
</group>
</group>
<tree node="appzone" />
<command name="appzone"
action="lua"
params="AppZone:handle('$')" />
</interface_config>

View file

@ -91,7 +91,11 @@
<action handler="set" params="target='ui:interface:gestion_windows:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:gestion_windows:w')),2)" /> <action handler="set" params="target='ui:interface:gestion_windows:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:gestion_windows:w')),2)" />
<action handler="set" params="target='ui:interface:gestion_windows:y'|value=add(getprop('ui:interface:gestion_windows:h'),div(sub(getprop('ui:interface:h'),getprop('ui:interface:gestion_windows:h')),2))" /> <action handler="set" params="target='ui:interface:gestion_windows:y'|value=add(getprop('ui:interface:gestion_windows:h'),div(sub(getprop('ui:interface:h'),getprop('ui:interface:gestion_windows:h')),2))" />
<action handler="set" params="target='ui:interface:gestion_windows:active'|value=@UI:TEMP:ACTIVE" /> <action handler="set" params="target='ui:interface:gestion_windows:active'|value=@UI:TEMP:ACTIVE" />
<!-- AppZone -->
<action handler="set" params="target='ui:interface:appzone:active'|value=1" />
<action handler="set" params="target='ui:interface:appzone:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:appzone:w')),2)" />
<action handler="set" params="target='ui:interface:appzone:y'|value=add(getprop('ui:interface:appzone:h'),2)" />
</proc> </proc>
<proc id="proc_reset_interface"> <proc id="proc_reset_interface">
@ -470,4 +474,4 @@
</proc> </proc>
</interface_config> </interface_config>

View file

@ -1091,7 +1091,10 @@
<instance template="win_button" id="webig" color="UI:SAVE:WIN:COLORS:COM" text="uimwWebIG" posparent="fame" posref="BL TL" x="0" y="-4" <instance template="win_button" id="webig" color="UI:SAVE:WIN:COLORS:COM" text="uimwWebIG" posparent="fame" posref="BL TL" x="0" y="-4"
pushflag="UI:VARIABLES:ISACTIVE:WEBIG" win_name="webig" /> pushflag="UI:VARIABLES:ISACTIVE:WEBIG" win_name="webig" />
<instance template="win_button" id="appzone" color="UI:SAVE:WIN:COLORS:COM" text="uimwAppZone" posparent="webig" posref="BL TL" x="0" y="-4"
pushflag="UI:VARIABLES:ISACTIVE:APPZONE" win_name="appzone" />
</group> </group>
<view type="bitmap" id="com_ico_back" posparent="communication" posref="TL TL" x="-22" y="22" texture="W_slot_categorie.tga" global_color="false" /> <view type="bitmap" id="com_ico_back" posparent="communication" posref="TL TL" x="-22" y="22" texture="W_slot_categorie.tga" global_color="false" />
<view type="bitmap" id="com_ico" posparent="com_ico_back" posref="MM MM" x="2" y="-2" texture="spe_com.tga" global_color="false" /> <view type="bitmap" id="com_ico" posparent="com_ico_back" posref="MM MM" x="2" y="-2" texture="spe_com.tga" global_color="false" />

View file

@ -0,0 +1,161 @@
-- global
WebBrowser = {
template = "webig_browser",
apps = {}
}
function WebBrowser:openWindow(id, url)
-- default value if url is not set
url = url or "http://app.ryzom.com/"
local newWindow = false
local app = self:findAppById(id)
if not app then
app = {}
app.id = id
app.title = ""
app.url = url
-- getUI() object
app.uiWindow = nil
app.winid = "ui:interface:" .. id
app.winw = 780
app.winh = 500
app.minimized = true
app.activeUrl = ""
table.insert(self.apps, app)
end
if not app.uiWindow then
-- if there is window present (eg, 'webig'), then reuse it
app.uiWindow = getUI(app.winid, false)
if not app.uiWindow then
app.uiWindow = createRootGroupInstance(self.template, app.id, {
x = 0, y = 0, w = app.winw, h = app.winh, home = app.url,
browse_redo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_redo",
browse_undo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_undo",
browse_refresh = "ui:interface:" .. app.id .. ":browser:header_opened:browse_refresh"
})
if not app.uiWindow then
return
end
app.uiWindow:center()
end
newWindow = true
end
app.activeUrl = url
-- trigger on_open event
if not app.uiWindow.opened then
app.uiWindow.opened = true
end
-- trigger on_active event
if not app.uiWindow.active then
app.uiWindow.active = true
end
local html = app.uiWindow:find("html")
html:browse(url)
setTopWindow(app.uiWindow)
end
function WebBrowser:findAppById(id)
for k,app in pairs(self.apps) do
if app.id == id then
return app
end
end
return nil
end
function WebBrowser:findAppFromUiCaller()
-- id = app123
local id = getUICaller().id:match("ui:interface:([^:]*):?")
local app = self:findAppById(id)
if app then
return app
end
end
function WebBrowser:onActive()
if app then
self:restoreWindow(app)
end
end
function WebBrowser:onClickHeaderClose()
local app = self:findAppFromUiCaller()
if app then
self:saveWindow(app)
end
end
function WebBrowser:onClickHeaderOpen()
local app = self:findAppFromUiCaller()
if app then
self:restoreWindow(app)
end
end
-- save current window dimension and minimize window
function WebBrowser:saveWindow(app)
app.minimized = true
app.winw = app.uiWindow.w
app.winh = app.uiWindow.h
-- minimize
app.uiWindow.w = 150
app.uiWindow.h = 0
end
function WebBrowser:restoreWindow(app)
if app.minimized then
app.uiWindow.w = app.winw
app.uiWindow.h = app.winh
app.minimized = false
end
end
function WebBrowser:onClickRedo()
-- caller is :header_opened:browse_redo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_redo", "name=" .. html.id)
end
end
function WebBrowser:onClickUndo()
-- caller is :header_opened:browse_undo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_undo", "name=" .. html.id)
end
end
function WebBrowser:onClickRefresh()
-- caller is :header_opened:browse_refresh
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:refresh()
end
end
function WebBrowser:onClickHome()
-- caller is :header_opened:browse_home
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:browse("home")
end
end

View file

@ -6927,7 +6927,203 @@
</group> </group>
</group> </group>
</template> </template>
<!-- html <hr> element -->
<!-- html browsing context -->
<template name="webig_html"
keep="true"
home=""
browse_redo=""
browse_undo=""
browse_refresh="">
<group id="html"
type="webig_html"
posref="TL TL"
home="#home"
title_prefix=""
sizeref="wh"
x="0"
y="0"
w="0"
h="0"
background_color="0 0 0 255"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="255 255 255 255"
text_font_size="10"
h1_font_size="20"
h2_font_size="18"
h3_font_size="16"
h4_font_size="14"
h5_font_size="12"
h6_font_size="12"
paragraph_begin_space="12"
multi_line_space_factor="0.25"
td_begin_space="0"
li_begin_space="4"
ul_begin_space="12"
li_indent="-10"
ul_indent="30"
checkbox_bitmap_normal="w_slot_on.tga"
checkbox_bitmap_pushed="w_opacity_on.tga"
checkbox_bitmap_over=""
background_bitmap_view="background_bitmap"
browse_next_time="false"
form_text_area_group="edit_box_widget_multiline"
browse_refresh="#browse_refresh"
browse_undo="#browse_undo"
browse_redo="#browse_redo"
timeout="10">
<group id="black"
posref="BR BR"
sizeref="hw"
w="-10"
h="-12"
inherit_gc_alpha="true" />
<instance template="inner_thin_border"
posparent="black"
inherit_gc_alpha="true " />
<view id="background_bitmap"
type="bitmap"
posparent="black"
posref="MM MM"
sizeref="wh"
w="-2"
h="-2"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
<group id="text_list"
type="list"
fontsize="9"
posref="TL TL"
posparent="black"
x="2"
y="-2"
space="0"
sizeref="hw"
w="-4"
h="-4"
maxelements="2000" />
<ctrl id="scroll_bar"
style="skin_scroll" />
</group>
</template>
<!-- html browser window -->
<template name="webig_browser"
keep="true"
home=""
w="480"
h="400"
browse_redo=""
browse_undo=""
browse_refresh="">
<group id="browser"
type="container"
w="#w"
h="#h"
x="0"
y="0"
pop_max_w="2000"
pop_max_h="2000"
pop_min_w="64"
pop_min_h="32"
header_color="UI:SAVE:WIN:COLORS:COM"
posref="TL TL"
title=""
global_color="true"
global_color_over="true"
right_button="true"
movable="true"
lockable="true"
active="true"
openable="true"
opened="true"
resizer="true"
on_active="lua"
on_active_params="WebBrowser:onActive()">
<group id="header_closed"
w="64"
h="16"
posref="TL TL"
on_active="lua"
on_active_params="WebBrowser:onClickHeaderClose()" />
<group id="header_opened"
h="16"
w="480"
posref="TL TL"
on_active="lua"
on_active_params="WebBrowser:onClickHeaderOpen()">
<ctrl style="text_button_header"
id="browse_redo"
button_type="push_button"
posref="MR MR"
x="-16"
y="0"
hardtext="uiBrowseRedoButton"
tooltip="uittBrowseRedo"
onclick_l="lua"
params_l="WebBrowser:onClickRedo()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_undo"
button_type="push_button"
posparent="browse_redo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseUndoButton"
tooltip="uittBrowseUndo"
onclick_l="lua"
params_l="WebBrowser:onClickUndo()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_refresh"
button_type="push_button"
posparent="browse_undo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseRefresh"
tooltip="uittBrowseRefresh"
onclick_l="lua"
params_l="WebBrowser:onClickRefresh()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_home"
button_type="push_button"
posparent="browse_refresh"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseHome"
tooltip="uittBrowseHome"
onclick_l="lua"
params_l="WebBrowser:onClickHome()" />
</group>
<group id="content"
x="0"
y="0"
w="0"
h="0"
posref="TL TL">
<instance template="webig_html"
home="#home"
browse_redo="#browse_redo"
browse_undo="#browse_undo"
browse_refresh="#browse_refresh" />
</group>
</group>
</template>
<!-- html <hr> element --> <!-- html <hr> element -->
<template name="html_hr" <template name="html_hr"
keep="true"> keep="true">