Merge branch 'fixes' into main/gingo-test
[ryzomcore.git] / ryzom / common / data_common / r2 / r2_ui_windows.lua
blob02e2b7893cf3bf5b09b5c78f5d17cc9913e84b80
1 -- management of visible editor windows
3 ---------------
4 -- FUNCTIONS --
5 ---------------
7 -------------------------------------------------------------------------------------
8 -- refresh the button that allow to toggle a window on / off
9 function r2:refreshWindowButtons()
10 -- debugInfo("refreshWindowButtons")
11 end
14 -------------------------------------------------------------------------------------
15 function r2:switchWindow(name)
16 local wnd = getUI(name)
17 wnd.active = not wnd.active
18 end
20 -------------------------------------------------------------------------------------
21 -- misc windows activation deactivation
22 function r2:switchPaletteWindow()
23 self:switchWindow("ui:interface:r2ed_palette")
24 end
26 function r2:switchScenarioWindow()
27 self:switchWindow("ui:interface:r2ed_scenario")
28 end
30 function r2:switchDebugWindow()
31 self:switchWindow("ui:interface:debug_info")
32 end
34 function r2:switchChatWindow()
35 self:switchWindow("ui:interface:main_chat")
36 end
38 function r2:switchWebAdminWindow()
39 self:switchWindow("ui:interface:r2ed_ring_window")
40 end
42 function r2:switchMailBoxWindow()
43 self:switchWindow("ui:interface:mailbox")
44 end
46 function r2:switchGuildForumWindow()
47 self:switchWindow("ui:interface:guild_forum")
48 end
50 function r2:switchMapWindow()
51 self:switchWindow("ui:interface:map")
52 end
54 function r2:switchPlayerAdminWindow()
55 self:switchWindow("ui:interface:ring_chars_tracking")
56 end
58 function r2:switchCustomBBoxWindow()
59 self:switchWindow("ui:interface:r2ed_bbox_edit")
60 if r2.CustomBBox.FirstDisplay == true then
61 if r2.CustomBBox:getWindow().active then
62 r2.CustomBBox:getWindow():center()
63 end
64 r2.CustomBBox.FirstDisplay = false
65 end
66 if r2.CustomBBox:getWindow().active then
67 runCommand("showR2EntityBoxes")
68 else
69 runCommand("hideR2EntityBoxes")
70 end
71 end
74 function r2:isPropertyWindowVisible()
75 if r2.PropertyWindowVisible == true then
76 if r2.CurrentPropertyWindow ~= nil then
77 return true
78 end
79 end
80 return false
81 end
83 function r2:switchPropertiesWindow()
84 if r2:isPropertyWindowVisible() then
85 if r2.CurrentPropertyWindow ~= nil then
86 r2.CurrentPropertyWindow.active = false
87 end
88 r2.PropertyWindowVisible = false
89 else
90 r2:showProperties(r2:getSelectedInstance())
91 end
92 end
94 ------------------
95 -- STATIC DATAS --
96 ------------------
98 r2.PropertyWindowVisible = false -- not stored in window because there are several "properties" windows (one per class)
99 r2.CurrentPropertyWindow = nil -- current property window being displayed
102 -----------------------------------------
103 -- INIT OF WINDOW POSITIONS AT STARTUP --
104 -----------------------------------------
107 -- init default pos for a property window
108 function r2:initDefaultPropertyWindowPosition(wnd)
109 if wnd == nil then
110 return
112 scrW, scrH = getWindowSize()
113 wnd.x = 4
114 wnd.y = scrH - 312
115 wnd.w = 225
116 wnd.h = 300