Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d4c4421
devel/dflayout: gui.dflayout fort toolbars demo
ChrisJohnsen Apr 6, 2025
6c26925
gui/mass-remove.toolbar: adopt gui.dflayout for positioning calculation
ChrisJohnsen Apr 6, 2025
9d5cbd9
devel/dflayout: use top-level gui.widgets module
ChrisJohnsen Apr 14, 2025
cc9f9d4
devel/dflayout: use globals for defclass
ChrisJohnsen Apr 14, 2025
61c793d
devel/dflayout: remove do-based scopes
ChrisJohnsen Apr 14, 2025
291d727
devel/dflayout: docs: shrink summary
ChrisJohnsen Apr 14, 2025
dd799bd
devel/dflayout: use global for ZScreen, provide focus_path
ChrisJohnsen Apr 14, 2025
8812284
devel/dflayout: docs: do not link to gui.dflayout
ChrisJohnsen Apr 14, 2025
91a06d3
devel/dflayout: provide Demo type
ChrisJohnsen Apr 15, 2025
e83410e
devel/dflayout: fix interface percentage change detection
ChrisJohnsen Apr 15, 2025
c2001bb
devel/dflayout: rework fort toolbar demos
ChrisJohnsen Apr 15, 2025
462fde5
devel/dflayout: cleanup focus checking and updating chaining
ChrisJohnsen Apr 15, 2025
062c7e7
devel/dflayout: use a global for visible_when_not_focused
ChrisJohnsen Apr 15, 2025
a0c2ccb
devel/dflayout: check interface percentage whenever demos are visible
ChrisJohnsen Apr 15, 2025
7a63210
devel/dflayout: move Window and ZScreen classes to end
ChrisJohnsen Apr 15, 2025
eef4fc5
devel/dflayout: provide on_render hook to demos
ChrisJohnsen Apr 15, 2025
df96afc
adapt to gui.dflayout overhaul
ChrisJohnsen Apr 23, 2025
8e8b0ea
Merge remote-tracking branch 'origin/master' into cj/mr-button/pr
ChrisJohnsen Apr 23, 2025
dc4e998
adapt gui/mass-remove.toolbar and devel/dflayout to latest gui.dflayout
ChrisJohnsen Apr 30, 2025
cfb6989
devel/dflayout: remove Demo.update
ChrisJohnsen Apr 30, 2025
012593f
Merge remote-tracking branch 'origin/master' into cj/mr-button/pr
ChrisJohnsen Apr 30, 2025
fe80662
devel/dflayout: use getUIElementStateChecker
ChrisJohnsen Apr 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
devel/dflayout: remove Demo.update
It was a remnant from before the toolbar demo panels did their own
position updating via the get_computeFrame_fn helper.

Interface size changes are automatically propagated from the ZScreen
through the updateLayout tree, and secondary toolbar changes are noticed
from the render hook.
  • Loading branch information
ChrisJohnsen committed Apr 30, 2025
commit cfb69894e07f22782a4fae1f951764722835f39f
20 changes: 4 additions & 16 deletions devel/dflayout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ local utils = require('utils')
---@field available fun(): boolean? return true if demo is available in current context
---@field active? boolean whether the main window has enabled this demo (managed by main window)
---@field views gui.View[] list of views to add to main ZScreen
---@field update? fun() called by main window to recompute demo frames
---@field on_render? fun() called by main window every render; useful to notice changes in overall UI state

if visible_when_not_focused == nil then
Expand Down Expand Up @@ -268,7 +267,7 @@ fort_toolbars_demo.views = {
}

---@param secondary? DFLayout.Fort.SecondaryToolbar.Names
local function update_fort_toolbars(secondary)
local function update_secondary_toolbar(secondary)
local function updateLayout(view)
if view.frame_parent_rect then
view:updateLayout()
Expand All @@ -291,6 +290,8 @@ local function update_fort_toolbars(secondary)
secondary_visible = false
end

-- update primary toolbar demos since their positions depends on whether a
-- secondary is active
updateLayout(left_toolbar_demo)
updateLayout(right_toolbar_demo)
updateLayout(center_toolbar_demo)
Expand Down Expand Up @@ -367,16 +368,12 @@ local function active_secondary()
end
end

fort_toolbars_demo.update = function()
update_fort_toolbars(active_secondary())
end

local secondary
fort_toolbars_demo.on_render = function()
local new_secondary = active_secondary()
if new_secondary ~= secondary then
secondary = new_secondary
update_fort_toolbars(secondary)
update_secondary_toolbar(secondary)
end
end

Expand Down Expand Up @@ -461,7 +458,6 @@ function DemoWindow:init(args)
on_submit = function(index, item)
local demo = self.demos[index]
demo.active = demo.available() and not demo.active
if demo.update and demo.active then demo.update() end
self:refresh()
end
},
Expand Down Expand Up @@ -530,14 +526,6 @@ function DemoScreen:render(...)
return DemoScreen.super.render(self, ...)
end

function DemoScreen:postComputeFrame(frame_body)
for _, demo in ipairs(self.demos) do
if demo.update and demo.available() and demo.active then
demo.update()
end
end
end

screen = screen and screen:raise() or DemoScreen{
demos = {
fort_toolbars_demo,
Expand Down