@ -273,7 +273,7 @@ end
function Panel : onInput ( keys )
function Panel : onInput ( keys )
if self.kbd_get_pos then
if self.kbd_get_pos then
if keys.SELECT or keys.LEAVESCREEN or keys._MOUSE_R _DOWN then
if keys.SELECT or keys.LEAVESCREEN or keys._MOUSE_R then
Panel_end_drag ( self , not keys.SELECT and self.saved_frame or nil ,
Panel_end_drag ( self , not keys.SELECT and self.saved_frame or nil ,
not not keys.SELECT )
not not keys.SELECT )
return true
return true
@ -281,7 +281,6 @@ function Panel:onInput(keys)
for code in pairs ( keys ) do
for code in pairs ( keys ) do
local dx , dy = guidm.get_movement_delta ( code , 1 , 10 )
local dx , dy = guidm.get_movement_delta ( code , 1 , 10 )
if dx then
if dx then
local frame_rect = self.frame_rect
local kbd_pos = self.kbd_get_pos ( )
local kbd_pos = self.kbd_get_pos ( )
kbd_pos.x = kbd_pos.x + dx
kbd_pos.x = kbd_pos.x + dx
kbd_pos.y = kbd_pos.y + dy
kbd_pos.y = kbd_pos.y + dy
@ -292,9 +291,9 @@ function Panel:onInput(keys)
return
return
end
end
if self.drag_offset then
if self.drag_offset then
if keys._MOUSE_R _DOWN then
if keys._MOUSE_R then
Panel_end_drag ( self , self.saved_frame )
Panel_end_drag ( self , self.saved_frame )
elseif keys._MOUSE_L then
elseif keys._MOUSE_L _DOWN then
Panel_update_frame ( self , Panel_make_frame ( self ) )
Panel_update_frame ( self , Panel_make_frame ( self ) )
end
end
return true
return true
@ -302,7 +301,7 @@ function Panel:onInput(keys)
if Panel.super . onInput ( self , keys ) then
if Panel.super . onInput ( self , keys ) then
return true
return true
end
end
if not keys._MOUSE_L _DOWN then return end
if not keys._MOUSE_L then return end
local x , y = self : getMouseFramePos ( )
local x , y = self : getMouseFramePos ( )
if not x then return end
if not x then return end
@ -489,7 +488,7 @@ function Panel:onRenderFrame(dc, rect)
dc : seek ( pos.x , pos.y ) : pen ( pen ) : char ( string.char ( 0xDB ) )
dc : seek ( pos.x , pos.y ) : pen ( pen ) : char ( string.char ( 0xDB ) )
end
end
if self.drag_offset and not self.kbd_get_pos
if self.drag_offset and not self.kbd_get_pos
and df.global . enabler.mouse_lbut == 0 then
and df.global . enabler.mouse_lbut _down == 0 then
Panel_end_drag ( self , nil , true )
Panel_end_drag ( self , nil , true )
end
end
end
end
@ -718,7 +717,7 @@ function EditField:onInput(keys)
end
end
end
end
if self.key and ( keys.LEAVESCREEN or keys._MOUSE_R _DOWN ) then
if self.key and ( keys.LEAVESCREEN or keys._MOUSE_R ) then
self : setText ( self.saved_text )
self : setText ( self.saved_text )
self : setFocus ( false )
self : setFocus ( false )
return true
return true
@ -740,8 +739,8 @@ function EditField:onInput(keys)
end
end
end
end
return not not self.key
return not not self.key
elseif keys._MOUSE_L then
elseif keys._MOUSE_L _DOWN then
local mouse_x , mouse_y = self : getMousePos ( )
local mouse_x = self : getMousePos ( )
if mouse_x then
if mouse_x then
self : setCursor ( self.start_pos + mouse_x - ( self.text_offset or 0 ) )
self : setCursor ( self.start_pos + mouse_x - ( self.text_offset or 0 ) )
return true
return true
@ -986,7 +985,7 @@ function Scrollbar:onRenderBody(dc)
if self.is_dragging then
if self.is_dragging then
scrollbar_do_drag ( self )
scrollbar_do_drag ( self )
end
end
if df.global . enabler.mouse_lbut == 0 then
if df.global . enabler.mouse_lbut _down == 0 then
self.last_scroll_ms = 0
self.last_scroll_ms = 0
self.is_dragging = false
self.is_dragging = false
self.scroll_spec = nil
self.scroll_spec = nil
@ -1023,7 +1022,7 @@ function Scrollbar:onInput(keys)
return true
return true
end
end
end
end
if not keys._MOUSE_L _DOWN then return false end
if not keys._MOUSE_L then return false end
local _ , y = self : getMousePos ( )
local _ , y = self : getMousePos ( )
if not y then return false end
if not y then return false end
local scroll_spec = nil
local scroll_spec = nil
@ -1386,11 +1385,11 @@ function Label:onInput(keys)
if self : inputToSubviews ( keys ) then
if self : inputToSubviews ( keys ) then
return true
return true
end
end
if keys._MOUSE_L _DOWN and self : getMousePos ( ) and self.on_click then
if keys._MOUSE_L and self : getMousePos ( ) and self.on_click then
self.on_click ( )
self.on_click ( )
return true
return true
end
end
if keys._MOUSE_R _DOWN and self : getMousePos ( ) and self.on_rclick then
if keys._MOUSE_R and self : getMousePos ( ) and self.on_rclick then
self.on_rclick ( )
self.on_rclick ( )
return true
return true
end
end
@ -1498,7 +1497,7 @@ end
function HotkeyLabel : onInput ( keys )
function HotkeyLabel : onInput ( keys )
if HotkeyLabel.super . onInput ( self , keys ) then
if HotkeyLabel.super . onInput ( self , keys ) then
return true
return true
elseif keys._MOUSE_L _DOWN and self : getMousePos ( ) and self.on_activate
elseif keys._MOUSE_L and self : getMousePos ( ) and self.on_activate
and not is_disabled ( self ) then
and not is_disabled ( self ) then
self.on_activate ( )
self.on_activate ( )
return true
return true
@ -1658,7 +1657,7 @@ end
function CycleHotkeyLabel : onInput ( keys )
function CycleHotkeyLabel : onInput ( keys )
if CycleHotkeyLabel.super . onInput ( self , keys ) then
if CycleHotkeyLabel.super . onInput ( self , keys ) then
return true
return true
elseif keys._MOUSE_L _DOWN and self : getMousePos ( ) and not is_disabled ( self ) then
elseif keys._MOUSE_L and self : getMousePos ( ) and not is_disabled ( self ) then
self : cycle ( )
self : cycle ( )
return true
return true
end
end
@ -1962,7 +1961,7 @@ function List:onInput(keys)
return self : submit ( )
return self : submit ( )
elseif keys.CUSTOM_SHIFT_ENTER then
elseif keys.CUSTOM_SHIFT_ENTER then
return self : submit2 ( )
return self : submit2 ( )
elseif keys._MOUSE_L _DOWN then
elseif keys._MOUSE_L then
local idx = self : getIdxUnderMouse ( )
local idx = self : getIdxUnderMouse ( )
if idx then
if idx then
local now_ms = dfhack.getTickCount ( )
local now_ms = dfhack.getTickCount ( )
@ -2317,7 +2316,7 @@ end
function Tab : onInput ( keys )
function Tab : onInput ( keys )
if Tab.super . onInput ( self , keys ) then return true end
if Tab.super . onInput ( self , keys ) then return true end
if keys._MOUSE_L _DOWN and self : getMousePos ( ) then
if keys._MOUSE_L and self : getMousePos ( ) then
self.on_select ( self.id )
self.on_select ( self.id )
return true
return true
end
end
@ -2419,7 +2418,7 @@ local function rangeslider_get_width_per_idx(self)
end
end
function RangeSlider : onInput ( keys )
function RangeSlider : onInput ( keys )
if not keys._MOUSE_L _DOWN then return false end
if not keys._MOUSE_L then return false end
local x = self : getMousePos ( )
local x = self : getMousePos ( )
if not x then return false end
if not x then return false end
local left_idx , right_idx = self.get_left_idx_fn ( ) , self.get_right_idx_fn ( )
local left_idx , right_idx = self.get_left_idx_fn ( ) , self.get_right_idx_fn ( )
@ -2527,7 +2526,7 @@ function RangeSlider:onRenderBody(dc, rect)
if self.is_dragging_target then
if self.is_dragging_target then
rangeslider_do_drag ( self , width_per_idx )
rangeslider_do_drag ( self , width_per_idx )
end
end
if df.global . enabler.mouse_lbut == 0 then
if df.global . enabler.mouse_lbut _down == 0 then
self.is_dragging_target = nil
self.is_dragging_target = nil
self.is_dragging_idx = nil
self.is_dragging_idx = nil
end
end