Skip to content

Commit

Permalink
New DesktopWindow button, fix to ponder_index
Browse files Browse the repository at this point in the history
Adds a new button visible in the context menu, which directly opens the Ponder index (using ponder_index)

Also fixes the ponder_index concommand so that it will open an existing panel instead of creating a new one
  • Loading branch information
LiddulBOFH committed Jan 23, 2025
1 parent e727cea commit 317c0ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lua/ponder/command_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ end, function(cmd, _, args)
end, "Open the Ponder storyboard for the given UUID")

concommand.Add("ponder_index", function(_, _, _)
Ponder.OpenIndex()
if IsValid(Ponder.UIWindow) then
Ponder.UIWindow:PonderShow()
else
Ponder.OpenIndex()
end
end, nil, "Open the Ponder index")

concommand.Add("ponder_restore", function(_, _, _)
Expand Down
13 changes: 12 additions & 1 deletion lua/ponder/core/userinterface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@ hook.Add("PopulateMenuBar", "Ponder.PopulateMenuBar.InsertMenuOption", function(
Ponder.OpenIndex()
end
end
end)
end)

list.Set("DesktopWindows", "Ponder", {
title = "Ponder",
icon = "materials/ponder/ui/icon64/magnifier.png",
width = 520,
height = 700,
init = function(_, window)
window:Remove()
RunConsoleCommand("ponder_index")
end
})

0 comments on commit 317c0ea

Please sign in to comment.