Skip to content

Commit

Permalink
make use of more specific focus strings
Browse files Browse the repository at this point in the history
  • Loading branch information
TymurGubayev authored Oct 2, 2023
1 parent d80af4f commit d06b5a8
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions gui/job-details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,40 +395,17 @@ function DetailsHotkeyOverlay:init()
}
end

local function isManagerOrderScreen()
local scr = ScrJobDetails()
return scr.context == df.job_details_context_type.MANAGER_WORK_ORDER
end

DetailsHotkeyOverlay_ManagerWorkOrder = defclass(DetailsHotkeyOverlay_ManagerWorkOrder, DetailsHotkeyOverlay)
DetailsHotkeyOverlay_ManagerWorkOrder.ATTRS{
default_pos={x=5, y=5}, -- {x=5, y=5} is right above the job title
viewscreens='dwarfmode/JobDetails/MANAGER_WORK_ORDER',
}
function DetailsHotkeyOverlay_ManagerWorkOrder:onRenderBody(dc)
if isManagerOrderScreen() then
self.subviews.button.visible = true
else
self.subviews.button.visible = false
return
end

DetailsHotkeyOverlay.super.onRenderBody(self, dc)
end

DetailsHotkeyOverlay_BuildingTask = defclass(DetailsHotkeyOverlay_BuildingTask, DetailsHotkeyOverlay)
DetailsHotkeyOverlay_BuildingTask.ATTRS{
default_pos={x=-123, y=6}, -- {x=-123, y=6} is right above the job title on all but smallest widths
default_pos={x=-120, y=6}, -- {x=-120, y=6} is right above the job title on all but smallest widths
viewscreens='dwarfmode/JobDetails/BUILDING_TASK_LIST',
}
function DetailsHotkeyOverlay_BuildingTask:onRenderBody(dc)
if not isManagerOrderScreen() then
self.subviews.button.visible = true
else
self.subviews.button.visible = false
return
end

DetailsHotkeyOverlay.super.onRenderBody(self, dc)
end

-- -------------------

Expand Down

0 comments on commit d06b5a8

Please sign in to comment.