Skip to content

Commit d5ab9f9

Browse files
Migrate scripts widgets constant to use getter/setter style
1 parent edd662a commit d5ab9f9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

gui/autodump.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function Autodump:onInput(keys)
253253
end
254254
local now_ms = dfhack.getTickCount()
255255
if same_xyz(pos, self.last_map_click_pos) and
256-
now_ms - self.last_map_click_ms <= widgets.DOUBLE_CLICK_MS then
256+
now_ms - self.last_map_click_ms <= widgets.getDoubleClickMs() then
257257
self:reset_double_click()
258258
self:do_dump(pos)
259259
self.mark = nil

gui/teleport.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function Teleport:onInput(keys)
296296
end
297297
local now_ms = dfhack.getTickCount()
298298
if same_xyz(pos, self.last_map_click_pos) and
299-
now_ms - self.last_map_click_ms <= widgets.DOUBLE_CLICK_MS then
299+
now_ms - self.last_map_click_ms <= widgets.getDoubleClickMs() then
300300
self:reset_double_click()
301301
self:do_teleport(pos)
302302
self.mark = nil

internal/control-panel/registry.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,26 +200,26 @@ PREFERENCES_BY_IDX = {
200200
desc='How long to wait for the second click of a double click, in ms.',
201201
default=500,
202202
min=50,
203-
get_fn=function() return widgets.DOUBLE_CLICK_MS end,
204-
set_fn=function(val) widgets.DOUBLE_CLICK_MS = val end,
203+
get_fn=widgets.getDoubleClickMs,
204+
set_fn=widgets.setDoubleClickMs,
205205
},
206206
{
207207
name='SCROLL_DELAY_MS',
208208
label='Mouse scroll repeat delay (ms)',
209209
desc='The delay between events when holding the mouse button down on a scrollbar, in ms.',
210210
default=20,
211211
min=5,
212-
get_fn=function() return widgets.SCROLL_DELAY_MS end,
213-
set_fn=function(val) widgets.SCROLL_DELAY_MS = val end,
212+
get_fn=widgets.getScrollDelayMs,
213+
set_fn=widgets.setScrollDelayMs,
214214
},
215215
{
216216
name='SCROLL_INITIAL_DELAY_MS',
217217
label='Mouse initial scroll repeat delay (ms)',
218218
desc='The delay before scrolling quickly when holding the mouse button down on a scrollbar, in ms.',
219219
default=300,
220220
min=5,
221-
get_fn=function() return widgets.SCROLL_INITIAL_DELAY_MS end,
222-
set_fn=function(val) widgets.SCROLL_INITIAL_DELAY_MS = val end,
221+
get_fn=widgets.getScrollInitialDelayMs,
222+
set_fn=widgets.setScrollInitialDelayMs,
223223
},
224224
}
225225

internal/journal/text_editor.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ function TextEditorView:getMultiLeftClick(x, y)
551551
if (
552552
self.last_click.x ~= x or
553553
self.last_click.y ~= y or
554-
from_last_click_ms > widgets.DOUBLE_CLICK_MS
554+
from_last_click_ms > widgets.getDoubleClickMs()
555555
) then
556556
self.clicks_count = 0;
557557
end

0 commit comments

Comments
 (0)