Added: Centralized base node panel expand routine

Fixed: All nodes are expanded/contracted correctly no matter where are clicked
Fixed: Database browser consistency between expander/node
Fixed: Sub-categories are expanded/contacted and state is preserved
This commit is contained in:
dvdvideo1234 2024-07-29 23:06:38 +03:00
parent 54b42533b0
commit 186db54456
3 changed files with 21 additions and 11 deletions

View File

@ -86,7 +86,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present
------------ CONFIGURE ASMLIB ------------
asmlib.InitBase("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","8.758")
asmlib.SetOpVar("TOOL_VERSION","8.759")
------------ CONFIGURE GLOBAL INIT OPVARS ------------

View File

@ -1710,6 +1710,22 @@ function GetDirectory(pCurr, vName)
return pItem, pItem[keyOb]
end
function SetExpandNode(pnBase)
if(inputIsKeyDown(KEY_LSHIFT)) then
if(pnBase:GetExpanded()) then
pnBase:ExpandRecurse(false)
else
pnBase:ExpandRecurse(true)
end
else
if(pnBase:GetExpanded()) then
pnBase:SetExpanded(false)
else
pnBase:SetExpanded(true)
end
end
end
function SetDirectory(pnBase, pCurr, vName)
if(not IsValid(pnBase)) then
LogInstance("Base panel invalid"); return nil end
@ -1724,11 +1740,8 @@ function SetDirectory(pnBase, pCurr, vName)
pCurr[sName] = {}; pCurr[sName][keyOb] = pNode
pNode:SetTooltip(languageGetPhrase("tool."..sTool..".subfolder"))
pNode.Icon:SetImage(ToIcon("subfolder_item"))
pNode.DoClick = function(pnSelf)
if(inputIsKeyDown(KEY_LSHIFT)) then
pNode:ExpandRecurse(true)
else pnSelf:SetExpanded(true) end
end
pNode.DoClick = function() SetExpandNode(pNode) end
pNode.Expander.DoClick = function() SetExpandNode(pNode) end
pNode.DoRightClick = function()
SetClipboardText(pNode:GetText())
end

View File

@ -2329,11 +2329,8 @@ function TOOL.BuildCPanel(CPanel)
local pRoot = pTree:AddNode(sTyp) -- No type folder made already
pRoot:SetTooltip(languageGetPhrase("tool."..gsToolNameL..".type"))
pRoot.Icon:SetImage(asmlib.ToIcon(defTable.Name))
pRoot.DoClick = function(pnSelf)
if(inputIsKeyDown(KEY_LSHIFT)) then
pnSelf:ExpandRecurse(true)
else pnSelf:SetExpanded(true) end
end
pRoot.DoClick = function() asmlib.SetExpandNode(pRoot) end
pRoot.Expander.DoClick = function() asmlib.SetExpandNode(pRoot) end
pRoot.DoRightClick = function()
local sID = asmlib.WorkshopID(sTyp)
if(sID and sID:len() > 0 and inputIsKeyDown(KEY_LSHIFT)) then