|  |  | @ -235,9 +235,13 @@ end | 
			
		
	
		
		
			
				
					
					|  |  |  | function render_text(obj,dc,x0,y0,pen,dpen,disabled) |  |  |  | function render_text(obj,dc,x0,y0,pen,dpen,disabled) | 
			
		
	
		
		
			
				
					
					|  |  |  |     local width = 0 |  |  |  |     local width = 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |     for iline,line in ipairs(obj.text_lines) do |  |  |  |     for iline,line in ipairs(obj.text_lines) do | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if dc and obj.start_line_num and iline < obj.start_line_num then | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             goto continue | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |         local x = 0 |  |  |  |         local x = 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if dc then |  |  |  |         if dc then | 
			
		
	
		
		
			
				
					
					|  |  |  |             dc:seek(x+x0,y0+iline-1) |  |  |  |             local offset = (obj.start_line_num or 1) - 1 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             dc:seek(x+x0,y0+iline-offset-1) | 
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |         for _,token in ipairs(line) do |  |  |  |         for _,token in ipairs(line) do | 
			
		
	
		
		
			
				
					
					|  |  |  |             token.line = iline |  |  |  |             token.line = iline | 
			
		
	
	
		
		
			
				
					|  |  | @ -323,6 +327,7 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled) | 
			
		
	
		
		
			
				
					
					|  |  |  |             token.x2 = x |  |  |  |             token.x2 = x | 
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |         width = math.max(width, x) |  |  |  |         width = math.max(width, x) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ::continue:: | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |     obj.text_width = width |  |  |  |     obj.text_width = width | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
	
		
		
			
				
					|  |  | @ -340,6 +345,13 @@ end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Label = defclass(Label, Widget) |  |  |  | Label = defclass(Label, Widget) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | STANDARDSCROLL = { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     STANDARDSCROLL_UP = -1, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     STANDARDSCROLL_DOWN = 1, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     STANDARDSCROLL_PAGEUP = '-page', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     STANDARDSCROLL_PAGEDOWN = '+page', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Label.ATTRS{ |  |  |  | Label.ATTRS{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     text_pen = COLOR_WHITE, |  |  |  |     text_pen = COLOR_WHITE, | 
			
		
	
		
		
			
				
					
					|  |  |  |     text_dpen = COLOR_DARKGREY, -- disabled |  |  |  |     text_dpen = COLOR_DARKGREY, -- disabled | 
			
		
	
	
		
		
			
				
					|  |  | @ -350,9 +362,11 @@ Label.ATTRS{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     auto_width = false, |  |  |  |     auto_width = false, | 
			
		
	
		
		
			
				
					
					|  |  |  |     on_click = DEFAULT_NIL, |  |  |  |     on_click = DEFAULT_NIL, | 
			
		
	
		
		
			
				
					
					|  |  |  |     on_rclick = DEFAULT_NIL, |  |  |  |     on_rclick = DEFAULT_NIL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     scroll_keys = STANDARDSCROLL, | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Label:init(args) |  |  |  | function Label:init(args) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     self.start_line_num = 1 | 
			
		
	
		
		
			
				
					
					|  |  |  |     self:setText(args.text) |  |  |  |     self:setText(args.text) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if not self.text_hpen then |  |  |  |     if not self.text_hpen then | 
			
		
	
		
		
			
				
					
					|  |  |  |         self.text_hpen = ((tonumber(self.text_pen) or tonumber(self.text_pen.fg) or 0) + 8) % 16 |  |  |  |         self.text_hpen = ((tonumber(self.text_pen) or tonumber(self.text_pen.fg) or 0) + 8) % 16 | 
			
		
	
	
		
		
			
				
					|  |  | @ -399,16 +413,33 @@ function Label:onRenderBody(dc) | 
			
		
	
		
		
			
				
					
					|  |  |  |     render_text(self,dc,0,0,text_pen,self.text_dpen,is_disabled(self)) |  |  |  |     render_text(self,dc,0,0,text_pen,self.text_dpen,is_disabled(self)) | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | function Label:scroll(nlines) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     local n = self.start_line_num + nlines | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     n = math.min(n, self:getTextHeight() - self.frame_body.height) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     n = math.max(n, 1) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     self.start_line_num = n | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Label:onInput(keys) |  |  |  | function Label:onInput(keys) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if not is_disabled(self) then |  |  |  |     if is_disabled(self) then return false end | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then |  |  |  |     if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             self:on_click() |  |  |  |         self:on_click() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |     end | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then |  |  |  |     if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             self:on_rclick() |  |  |  |         self:on_rclick() | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     for k,v in pairs(self.scroll_keys) do | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if keys[k] then | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if v == '+page' then | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 v = self.frame_body.height | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             elseif v == '-page' then | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 v = -self.frame_body.height | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             self:scroll(v) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return true | 
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |         return check_text_keys(self, keys) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return check_text_keys(self, keys) | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | ---------- |  |  |  | ---------- | 
			
		
	
	
		
		
			
				
					|  |  | @ -417,13 +448,6 @@ end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | List = defclass(List, Widget) |  |  |  | List = defclass(List, Widget) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | STANDARDSCROLL = { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     STANDARDSCROLL_UP = -1, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     STANDARDSCROLL_DOWN = 1, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     STANDARDSCROLL_PAGEUP = '-page', |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     STANDARDSCROLL_PAGEDOWN = '+page', |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | SECONDSCROLL = { |  |  |  | SECONDSCROLL = { | 
			
		
	
		
		
			
				
					
					|  |  |  |     SECONDSCROLL_UP = -1, |  |  |  |     SECONDSCROLL_UP = -1, | 
			
		
	
		
		
			
				
					
					|  |  |  |     SECONDSCROLL_DOWN = 1, |  |  |  |     SECONDSCROLL_DOWN = 1, | 
			
		
	
	
		
		
			
				
					|  |  | 
 |