From 99307b619a5aa27bef3bb67027c4cb5e54f21ad4 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Aug 2024 19:46:52 +0300 Subject: Lua api for adjusting toolbars --- indra/newview/scripts/lua/require/UI.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 06b49c6269..30b7189c3c 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -169,4 +169,34 @@ function UI.addMenuSeparator(...) return leap.request('UI', args) end +-- *************************************************************************** +-- Toolbar buttons +-- *************************************************************************** +-- Clears all buttons off the toolbars +function UI.clearToolbars() + leap.send('UI', {op='clearToolbars'}) +end + +function UI.defaultToolbars() + leap.send('UI', {op='defaultToolbars'}) +end + +-- UI.addToolbarBtn{btn_name=btn_name +-- [, toolbar= 3] -- 1 [TOOLBAR_LEFT], 2 [TOOLBAR_RIGHT], 3 [TOOLBAR_BOTTOM] +-- [, rank=1]} -- position on the toolbar +function UI.addToolbarBtn(...) + local args = mapargs('btn_name,toolbar,rank', ...) + args.op = 'addToolbarBtn' + return leap.request('UI', args) +end + +-- Returns the rank(position) of the command in the original list +function UI.removeToolbarBtn(btn_name) + return leap.request('UI', {op = 'removeToolbarBtn', btn_name=btn_name}).rank +end + +function UI.getToolbarBtnNames() + return leap.request('UI', {op = 'getToolbarBtnNames'}).cmd_names +end + return UI -- cgit v1.2.3 From a67a01240cbd58a1800290294be83e7b874fefb6 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Aug 2024 20:19:53 +0300 Subject: Lua api for showing/hiding floater; rename demo scripts --- indra/newview/scripts/lua/require/UI.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 30b7189c3c..df77eb2b56 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -199,4 +199,27 @@ function UI.getToolbarBtnNames() return leap.request('UI', {op = 'getToolbarBtnNames'}).cmd_names end +-- *************************************************************************** +-- Floaters +-- *************************************************************************** +function UI.showFloater(floater_name) + leap.send("LLFloaterReg", {op = "showInstance", name = floater_name}) +end + +function UI.hideFloater(floater_name) + leap.send("LLFloaterReg", {op = "hideInstance", name = floater_name}) +end + +function UI.toggleFloater(floater_name) + leap.send("LLFloaterReg", {op = "toggleInstance", name = floater_name}) +end + +function UI.isFloaterVisible(floater_name) + return leap.request("LLFloaterReg", {op = "instanceVisible", name = floater_name}).visible +end + +function UI.closeAllFloaters() + return leap.send("UI", {op = "closeAllFloaters"}) +end + return UI -- cgit v1.2.3 From cf29b701b19644062a1428a64023c3cf9829e2de Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 5 Aug 2024 20:37:03 +0300 Subject: Allow getting the list of floater names, hide top menu items; add demo script --- indra/newview/scripts/lua/require/UI.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index df77eb2b56..df76b1501c 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -150,6 +150,10 @@ function UI.addMenu(...) return leap.request('UI', args) end +function UI.setMenuVisible(name, visible) + return leap.request('UI', {op='setMenuVisible', name=name, visible=visible}) +end + function UI.addMenuBranch(...) local args = mapargs('name,label,parent_menu', ...) args.op = 'addMenuBranch' @@ -222,4 +226,8 @@ function UI.closeAllFloaters() return leap.send("UI", {op = "closeAllFloaters"}) end +function UI.getFloaterNames() + return leap.request("LLFloaterReg", {op = "getFloaterNames"}).floaters +end + return UI -- cgit v1.2.3 From eb82c78b071d71a0fd2d7be1c573997e41bab51e Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 6 Aug 2024 20:38:06 +0300 Subject: code clean up --- indra/newview/scripts/lua/require/UI.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index df76b1501c..9bc9a3685d 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -177,8 +177,8 @@ end -- Toolbar buttons -- *************************************************************************** -- Clears all buttons off the toolbars -function UI.clearToolbars() - leap.send('UI', {op='clearToolbars'}) +function UI.clearAllToolbars() + leap.send('UI', {op='clearAllToolbars'}) end function UI.defaultToolbars() @@ -186,8 +186,8 @@ function UI.defaultToolbars() end -- UI.addToolbarBtn{btn_name=btn_name --- [, toolbar= 3] -- 1 [TOOLBAR_LEFT], 2 [TOOLBAR_RIGHT], 3 [TOOLBAR_BOTTOM] --- [, rank=1]} -- position on the toolbar +-- [, toolbar= bottom] -- left, right, bottom -- default is bottom +-- [, rank=1]} -- position on the toolbar, starts at 0 (0 - first position, 1 - second position etc.) function UI.addToolbarBtn(...) local args = mapargs('btn_name,toolbar,rank', ...) args.op = 'addToolbarBtn' -- cgit v1.2.3