./vdo_export_progress_meter.lua

  1. -- Inherited from Vdo_base_object 
  2. Vdo_export_progress_meter = Vdo_base_object:new_base() 
  3.  
  4. -- Standard Init Function 
  5. function vdo_export_progress_meter_init() 
  6. end 
  7.  
  8. -- Standard Cleanup Function 
  9. function vdo_export_progress_meter_cleanup() 
  10. end 
  11.  
  12. function Vdo_export_progress_meter:init() 
  13. 	-- Get points to the elements 
  14. 	self.label_txt = Vdo_base_object:new("label_txt", self.handle, self.doc_handle) 
  15. 	self.bg = Vdo_base_object:new("bg", self.handle, self.doc_handle) 
  16. 	self.fill = Vdo_base_object:new("fill", self.handle, self.doc_handle) 
  17. end 
  18.  
  19. ------------------------------------------------------------------------------- 
  20. --Updates the meter 
  21. ------------------------------------------------------------------------------- 
  22. function Vdo_export_progress_meter:update(visible, label, meter_percent, highlight_label) 
  23. 	--Set visible 
  24. 	self:set_visible(visible) 
  25. 	 
  26. 	if label ~= nil and label ~= "" then 
  27. 		self.label_txt:set_text(label) 
  28. 	end 
  29. 	 
  30. 	if highlight_label == false then 
  31. 		self.label_txt:set_color(0, 0, 0) 
  32. 	else 
  33. 		self.label_txt:set_color(220, 220, 220) 
  34. 	end 
  35. 	 
  36. 	--Setup properties for fills 
  37. 	--Set Meter Fill based on percent input 
  38. 	local fill_width, fill_height = element_get_actual_size(self.fill.handle) 
  39. 	local bg_width, bg_height = element_get_actual_size(self.bg.handle, "scale") 
  40.  
  41. 	fill_width = bg_width * meter_percent 
  42. 	self.fill:set_actual_size(fill_width, fill_height) 
  43. end 
  44.  
  45. -- Standard Indicator Functions 
  46. function Vdo_export_progress_meter:set_visible(visible) 
  47. 	--Hide the indicator if it is not visible 
  48. 	if visible ~= self.visible then 
  49. 		if visible == true then 
  50. 			self:set_property("visible", true) 
  51. 			self.visible = visible 
  52. 		else 
  53. 			self:set_property("visible", false) 
  54. 			self.visible = visible 
  55. 		end 
  56. 	end 
  57. end