Skip to content

Commit 036ddb3

Browse files
authored
Merge pull request #1313 from wiktor-obrebski/fix/widgets-constants
Migrate scripts widgets constant to use getter/setter style
2 parents baf6610 + d5ab9f9 commit 036ddb3

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
@@ -202,26 +202,26 @@ PREFERENCES_BY_IDX = {
202202
desc='How long to wait for the second click of a double click, in ms.',
203203
default=500,
204204
min=50,
205-
get_fn=function() return widgets.DOUBLE_CLICK_MS end,
206-
set_fn=function(val) widgets.DOUBLE_CLICK_MS = val end,
205+
get_fn=widgets.getDoubleClickMs,
206+
set_fn=widgets.setDoubleClickMs,
207207
},
208208
{
209209
name='SCROLL_DELAY_MS',
210210
label='Mouse scroll repeat delay (ms)',
211211
desc='The delay between events when holding the mouse button down on a scrollbar, in ms.',
212212
default=20,
213213
min=5,
214-
get_fn=function() return widgets.SCROLL_DELAY_MS end,
215-
set_fn=function(val) widgets.SCROLL_DELAY_MS = val end,
214+
get_fn=widgets.getScrollDelayMs,
215+
set_fn=widgets.setScrollDelayMs,
216216
},
217217
{
218218
name='SCROLL_INITIAL_DELAY_MS',
219219
label='Mouse initial scroll repeat delay (ms)',
220220
desc='The delay before scrolling quickly when holding the mouse button down on a scrollbar, in ms.',
221221
default=300,
222222
min=5,
223-
get_fn=function() return widgets.SCROLL_INITIAL_DELAY_MS end,
224-
set_fn=function(val) widgets.SCROLL_INITIAL_DELAY_MS = val end,
223+
get_fn=widgets.getScrollInitialDelayMs,
224+
set_fn=widgets.setScrollInitialDelayMs,
225225
},
226226
}
227227

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)